pub struct BuildError {
pub file: Option<String>,
pub line: Option<usize>,
pub message: String,
}Expand description
Serialisable build error for browser overlay delivery.
Fields§
§file: Option<String>Source file path (if extractable from the error chain).
line: Option<usize>Line number (if extractable).
message: StringHuman-readable error message.
Implementations§
Source§impl BuildError
impl BuildError
Sourcepub fn from_error(err: &SsgError) -> Self
pub fn from_error(err: &SsgError) -> Self
Creates a BuildError from an SsgError error, attempting to extract
file path and line number from the error chain.
§Examples
use ssg::pipeline::BuildError;
use ssg::SsgError;
let err = SsgError::Validation { field: "x".into(), message: "nope".into() };
let be = BuildError::from_error(&err);
assert!(be.message.contains("nope"));Sourcepub fn to_ws_message(&self) -> String
pub fn to_ws_message(&self) -> String
Serializes to a WebSocket JSON message.
§Examples
use ssg::pipeline::BuildError;
let be = BuildError { file: None, line: None, message: "boom".into() };
let msg = be.to_ws_message();
assert!(msg.contains("\"type\":\"error\""));
assert!(msg.contains("boom"));Trait Implementations§
Source§impl Clone for BuildError
impl Clone for BuildError
Source§fn clone(&self) -> BuildError
fn clone(&self) -> BuildError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BuildError
impl Debug for BuildError
Auto Trait Implementations§
impl Freeze for BuildError
impl RefUnwindSafe for BuildError
impl Send for BuildError
impl Sync for BuildError
impl Unpin for BuildError
impl UnsafeUnpin for BuildError
impl UnwindSafe for BuildError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more