macro_rules! report {
($err:expr $(,)?) => { ... };
}๐Deprecated since 0.6.0: use
IntoReport::into_report insteadExpand description
Creates a Report from the given parameters.
The parameters may either be Error or a Report. The returned Report will use the
the provided type as context.
ยงExamples
use std::fs;
use anystack::report;
match fs::read_to_string("/path/to/file") {
Ok(content) => println!("file contents: {content}"),
Err(err) => return Err(report!(err)),
}use core::error::Error;
use core::fmt;
use anystack::report;
#[derive(Debug)]
struct PermissionDenied(User, Resource);
impl fmt::Display for PermissionDenied {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
...
}
impl Error for PermissionDenied {}
if !has_permission(&user, &resource) {
return Err(report!(PermissionDenied(user, resource)));
}