pub struct Error<W: Warning> { /* private fields */ }Expand description
The warning that caused an operation to fail.
The Warning is referred to by the json::Elements path as a String.
Implementations§
Source§impl<W: Warning> Error<W>
impl<W: Warning> Error<W>
Sourcepub fn warning(&self) -> &W
pub fn warning(&self) -> &W
Return reference to the Warning.
Examples found in repository?
More examples
examples/price_cdr_with_unknown_version.rs (line 93)
89fn print_timezone_error(error: &warning::Error<timezone::Warning>) {
90 eprintln!(
91 "ERR: Unable to find timezone due to error at path `{}`: {}",
92 error.element().path,
93 error.warning()
94 );
95}
96
97fn print_timezone_warnings(warnings: &warning::Set<timezone::Warning>) {
98 if warnings.is_empty() {
99 return;
100 }
101
102 eprintln!(
103 "WARN: {} warnings from the timezone search",
104 warnings.len_warnings()
105 );
106
107 eprintln!(
108 "WARN: {} warnings from the timezone search:\n {}",
109 warnings.len_warnings(),
110 warning::SetWriter::new(warnings)
111 );
112}
113
114fn print_pricing_error(error: &warning::Error<price::Warning>) {
115 eprintln!(
116 "ERR: Unable to price CDR due to error at path `{}`: {}",
117 error.element().path,
118 error.warning()
119 );
120}Sourcepub fn into_warning(self) -> W
pub fn into_warning(self) -> W
Consume the Error and return the Warning.
Sourcepub fn element(&self) -> &Element
pub fn element(&self) -> &Element
Examples found in repository?
More examples
examples/price_cdr_with_unknown_version.rs (line 92)
89fn print_timezone_error(error: &warning::Error<timezone::Warning>) {
90 eprintln!(
91 "ERR: Unable to find timezone due to error at path `{}`: {}",
92 error.element().path,
93 error.warning()
94 );
95}
96
97fn print_timezone_warnings(warnings: &warning::Set<timezone::Warning>) {
98 if warnings.is_empty() {
99 return;
100 }
101
102 eprintln!(
103 "WARN: {} warnings from the timezone search",
104 warnings.len_warnings()
105 );
106
107 eprintln!(
108 "WARN: {} warnings from the timezone search:\n {}",
109 warnings.len_warnings(),
110 warning::SetWriter::new(warnings)
111 );
112}
113
114fn print_pricing_error(error: &warning::Error<price::Warning>) {
115 eprintln!(
116 "ERR: Unable to price CDR due to error at path `{}`: {}",
117 error.element().path,
118 error.warning()
119 );
120}Sourcepub fn into_parts(self) -> (W, Element)
pub fn into_parts(self) -> (W, Element)
Consume the Cause and return the constituent parts.
Trait Implementations§
Source§impl<W: Warning> Error for Error<W>
impl<W: Warning> Error for Error<W>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl<W> Freeze for Error<W>where
W: Freeze,
impl<W> RefUnwindSafe for Error<W>where
W: RefUnwindSafe,
impl<W> Send for Error<W>
impl<W> Sync for Error<W>
impl<W> Unpin for Error<W>where
W: Unpin,
impl<W> UnwindSafe for Error<W>where
W: UnwindSafe,
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