Skip to content

Commit

Permalink
Merge pull request #403 from mkantor/render-error-punctuation
Browse files Browse the repository at this point in the history
Fix punctuation in errors built with `RenderError::from_error`.
  • Loading branch information
sunng87 committed Dec 25, 2020
2 parents 6b25917 + 547fe5d commit 7e4a994
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/error.rs
Expand Up @@ -47,45 +47,45 @@ impl Error for RenderError {

impl From<IOError> for RenderError {
fn from(e: IOError) -> RenderError {
RenderError::from_error("Error on output generation.", e)
RenderError::from_error("Error on output generation", e)
}
}

impl From<SerdeError> for RenderError {
fn from(e: SerdeError) -> RenderError {
RenderError::from_error("Error when accessing JSON data.", e)
RenderError::from_error("Error when accessing JSON data", e)
}
}

impl From<FromUtf8Error> for RenderError {
fn from(e: FromUtf8Error) -> RenderError {
RenderError::from_error("Error on bytes generation.", e)
RenderError::from_error("Error on bytes generation", e)
}
}

impl From<ParseIntError> for RenderError {
fn from(e: ParseIntError) -> RenderError {
RenderError::from_error("Error on accessing array/vector with string index.", e)
RenderError::from_error("Error on accessing array/vector with string index", e)
}
}

impl From<TemplateError> for RenderError {
fn from(e: TemplateError) -> RenderError {
RenderError::from_error("Error with parsing template.", e)
RenderError::from_error("Error with parsing template", e)
}
}

#[cfg(feature = "script_helper")]
impl From<Box<EvalAltResult>> for RenderError {
fn from(e: Box<EvalAltResult>) -> RenderError {
RenderError::from_error("Error on converting data to Rhai dynamic.", e)
RenderError::from_error("Error on converting data to Rhai dynamic", e)
}
}

#[cfg(feature = "script_helper")]
impl From<ScriptError> for RenderError {
fn from(e: ScriptError) -> RenderError {
RenderError::from_error("Error loading rhai script.", e)
RenderError::from_error("Error loading rhai script", e)
}
}

Expand Down

0 comments on commit 7e4a994

Please sign in to comment.