-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I found something interesting in std, here's an example:
use std::panic::Location;
fn validate(/*something that you want to validate*/) -> ... {
if something_not_valid {
let location = Location::caller();
return Err(anyhow!(format!(
"{location}: ..."
)));
}
}this code produces a message like:
src/filename.rs:line:position: ...
it might be helpful to
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels