mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-01 17:15:46 +01:00
Improve Lib Readability
Signed-off-by: Ryan Russell <git@ryanrussell.org>
This commit is contained in:
parent
3e46543060
commit
4b6c3e72ff
@ -73,12 +73,12 @@ impl aweb::error::ResponseError for ResponseError {
|
|||||||
pub trait ErrorCode: std::error::Error {
|
pub trait ErrorCode: std::error::Error {
|
||||||
fn error_code(&self) -> Code;
|
fn error_code(&self) -> Code;
|
||||||
|
|
||||||
/// returns the HTTP status code ascociated with the error
|
/// returns the HTTP status code associated with the error
|
||||||
fn http_status(&self) -> StatusCode {
|
fn http_status(&self) -> StatusCode {
|
||||||
self.error_code().http()
|
self.error_code().http()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// returns the doc url ascociated with the error
|
/// returns the doc url associated with the error
|
||||||
fn error_url(&self) -> String {
|
fn error_url(&self) -> String {
|
||||||
self.error_code().url()
|
self.error_code().url()
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ pub enum Code {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Code {
|
impl Code {
|
||||||
/// ascociate a `Code` variant to the actual ErrCode
|
/// associate a `Code` variant to the actual ErrCode
|
||||||
fn err_code(&self) -> ErrCode {
|
fn err_code(&self) -> ErrCode {
|
||||||
use Code::*;
|
use Code::*;
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ impl Code {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return the HTTP status code ascociated with the `Code`
|
/// return the HTTP status code associated with the `Code`
|
||||||
fn http(&self) -> StatusCode {
|
fn http(&self) -> StatusCode {
|
||||||
self.err_code().status_code
|
self.err_code().status_code
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ impl Code {
|
|||||||
self.err_code().error_type.to_string()
|
self.err_code().error_type.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return the doc url ascociated with the error
|
/// return the doc url associated with the error
|
||||||
fn url(&self) -> String {
|
fn url(&self) -> String {
|
||||||
format!("https://docs.meilisearch.com/errors#{}", self.name())
|
format!("https://docs.meilisearch.com/errors#{}", self.name())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user