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
97/// Print the `timezone::Warning`s to `stderr`.
98fn print_timezone_warnings(warnings: &warning::Set<timezone::Warning>) {
99 if warnings.is_empty() {
100 return;
101 }
102
103 eprintln!(
104 "WARN: {} warnings from the timezone search",
105 warnings.len_warnings()
106 );
107
108 eprintln!(
109 "WARN: {} warnings from the timezone search:\n {}",
110 warnings.len_warnings(),
111 warning::SetWriter::new(warnings)
112 );
113}
114
115/// Print the `price::Warning` that halted the process to `stderr`.
116fn print_pricing_error(error: &warning::Error<price::Warning>) {
117 eprintln!(
118 "ERR: Unable to price CDR due to error at path `{}`: {}",
119 error.element().path(),
120 error.warning()
121 );
122}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
97/// Print the `timezone::Warning`s to `stderr`.
98fn print_timezone_warnings(warnings: &warning::Set<timezone::Warning>) {
99 if warnings.is_empty() {
100 return;
101 }
102
103 eprintln!(
104 "WARN: {} warnings from the timezone search",
105 warnings.len_warnings()
106 );
107
108 eprintln!(
109 "WARN: {} warnings from the timezone search:\n {}",
110 warnings.len_warnings(),
111 warning::SetWriter::new(warnings)
112 );
113}
114
115/// Print the `price::Warning` that halted the process to `stderr`.
116fn print_pricing_error(error: &warning::Error<price::Warning>) {
117 eprintln!(
118 "ERR: Unable to price CDR due to error at path `{}`: {}",
119 error.element().path(),
120 error.warning()
121 );
122}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> UnsafeUnpin for Error<W>where
W: UnsafeUnpin,
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