Hi everyone (this is copied from reddit)!!!
I've been developing a 0 dependency error crate with an API similar to anyhow for a while now!! It is designed with a friendly API first for frontend applications/small backend API's.
It similarly allows for the try operator on most error types, with a Result< T >, BoxResl< T >
Sorry I didn't include this before. Wasn't super ready to post it yet, and was really seeing if there was interest!
//An example of using the API
fn example<T>(any:T)->Result<T>{
mostresultfunc?;
anyresultfunc.map_appair()?;
//Add context to errors with an API similar to anyhow
anyresultfunc.with_context("msg")?;
anyresultfunc.any_context(d:Display)?;
//Assign error codes
anyresultfunc.assign_code(f64)?;
//Minimal example of a new error
AppError::Error("static error msg")
AppError::from(error string)
}
///Under the hood this uses dynamic errors and can be
///Used concurrently with Result<T>
fn example<T>(any:T)->BoxResl<T>{
anyresultfunc?;
anyresultfunc.map_appair()?;
anyresultfunc.with_context("msg")?;
anyresultfunc.any_context(d:Display)?;
//Creating a new error
BoxErr::new()
}
It is somewhat performant, though it does especially well in frontend apps (especially Tauri/Flutter Rust Bridge). If there is any interest let me know, and I will make it public, otherwise I'll just keep this implementation personal​![]()