Improve Lib Readability

Signed-off-by: Ryan Russell <git@ryanrussell.org>
This commit is contained in:
Ryan Russell 2022-06-04 21:38:04 -05:00
parent 3e46543060
commit 4b6c3e72ff
No known key found for this signature in database
GPG Key ID: 8A7DE15B3F4F5007

View File

@ -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())
} }