6 releases (1 stable)
3.0.0 | Oct 3, 2024 |
---|---|
3.0.0-alpha.11 | Sep 18, 2023 |
3.0.0-alpha.3 | Jul 10, 2023 |
3.0.0-alpha.2 | Apr 13, 2023 |
3.0.0-alpha.1 |
|
#1780 in Network programming
28 downloads per month
Used in 4 crates
(2 directly)
15KB
88 lines
Torrust Tracker Located Error
A library to provide an error decorator with the location and the source of the original error.
Documentation
License
The project is licensed under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE.
lib.rs
:
This crate provides a wrapper around an error that includes the location of the error.
use std::error::Error;
use std::panic::Location;
use std::sync::Arc;
use torrust_tracker_located_error::{Located, LocatedError};
#[derive(thiserror::Error, Debug)]
enum TestError {
#[error("Test")]
Test,
}
#[track_caller]
fn get_caller_location() -> Location<'static> {
*Location::caller()
}
let e = TestError::Test;
let b: LocatedError<TestError> = Located(e).into();
let l = get_caller_location();
assert!(b.to_string().contains("Test, src/lib.rs"));
Credits
Dependencies
~305–410KB