Error context library with support for type-erased sources and backtraces, targeting full support of all features on stable Rust

Related tags

Utilities anomaly
Overview

anomaly.rs 🦠 iqlusion

Crate Docs Apache 2.0/MIT Licensed MSRV Safety Dance Build Status Gitter Chat

Error context library with support for type-erased sources and backtraces, targeting full support of all features on stable Rust, and with an eye towards serializing runtime errors using serde.

Documentation

About

anomaly.rs draws inspiration from libraries like error-chain, failure, and anyhow to provide the following features:

  • An anomaly::Context type which impls std::error::Error including support for type-erased anomaly::BoxError sources. Contexts are generic around an error Kind, making the sources optional, and generally trying to strike a balance between typed errors and Box-based type erasure.
  • Stringly typed errors using the anomaly::Message type, with a set of macros to construct these errors.
  • Backtrace support using the backtrace crate, and with it support for stable Rust where other libraries might require nightly.
  • Support for serializing errors using serde, allowing them to be submitted to exception reporting services and other structured logging systems.

Notably anomaly.rs does NOT include any sort of proc macro to define its error Kind type. We recommend thiserror for that purpose.

What makes anomaly.rs different?

anomaly::Context and its Box-ed wrapper, anomaly::Error, are generic around a concrete Kind type. Type erasure (based on std::error::Error) is only used when constructing error chains:

  • Concrete (generic) types for immediate errors
  • Type erasure for error sources
  • No additional traits beyond std::error::Error
  • Stringly typed anomaly::Message for where enum variants are too cumbersome or error messages are coming from e.g. API responses.
  • Structured logging of your errors using serde

History

anomaly.rs is an extraction of a set of patterns and boilerplate from real-world libraries and applications, most notably Abscissa.

Requirements

  • Rust 1.38+

License

Copyright © 2019-2020 iqlusion

anomaly.rs is distributed under the terms of either the MIT license or the Apache License (Version 2.0), at your option.

See LICENSE (Apache License, Version 2.0) file in the iqlusioninc/crates toplevel directory of this repository or LICENSE-MIT for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

You might also like...
Utilities to gather data out of roms. Written in Rust. It (should) support all types.

snesutilities Utilities to gather data out of roms. Written in Rust. It (should) support all types. How Have a look at main.rs: use snesutilities::Sne

Mononym is a library for creating unique type-level names for each value in Rust.

Mononym is a library for creating unique type-level names for each value in Rust.

Awesome full-stack template using Yew and Rust
Awesome full-stack template using Yew and Rust

Docker + Actix + Yew Full Stack Template 👨‍💻 YouTube videos Full Stack Rust App Template using Yew + Actix! https://youtu.be/oCiGjrpGk4A Add Docker

Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps.

rust-yew-axum-tauri-desktop template Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps. Crates frontend: Yew frontend app for de

This article is about the unsound api which I found in owning_ref. Owning_ref is a library that has 11 million all-time downloads and 60 reverse dependencies.

Unsoundness in owning_ref This article is about the unsound api which I found in owning_ref. Owning_ref is a library that has 11 million all-time down

A VtubeStudio plugin that allows iFacialMocap to stream data to the app, enabling full apple ARkit facial tracking to be used for 2D Vtuber models.

facelink_rs A VtubeStudio plugin that allows iFacialMocap to stream data to the app, enabling full apple ARkit facial tracking to be used for 2D Vtube

A box full of utilities, a unworthy replacement for coreutils / busybox / toybox.

Gearbox A box full of utilities, a unworthy replacement for coreutils / busybox / toybox. List of content How to setup Systems Ubuntu Arch How to buil

CBOR (binary JSON) for Rust with automatic type based decoding and encoding.

THIS PROJECT IS UNMAINTAINED. USE serde_cbor INSTEAD. This crate provides an implementation of RFC 7049, which specifies Concise Binary Object Represe

Type-check non-existing `Phantom` code for Fun And Profit
Type-check non-existing `Phantom` code for Fun And Profit

Sometimes you may want to write Rust code that ought to be type-checked (e.g., borrow-checked) in the same fashion as real Rust code even though that code is never intended to be run / to affect or even reach code generation.

Owner
Findora Foundation
Findora Foundation
Translate C++/Rust type into C type with the same memory layout

clayout, translate C++/Rust type into C type with the same memory layout. Generally, clayout is used together with bpftrace. clayout is developed on d

盏一 11 Nov 17, 2022
Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. After all it's just a cat.

Bongo Copy Cat Introduction Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. Afte

Abhijeet Singh 4 Jan 23, 2023
Rust Util Collection, a simple and friendly error-chain

RUC Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition. The painful experience of using error-chain gave b

漢 8 Dec 8, 2022
Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition.

RUC Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition. The painful experience of using error-chain gave b

漢 6 Mar 27, 2022
my attempt at compromise between unwrapping and bullying my dependencies' authors for Error impl

string-eyre Has this happened to you? error[E0599]: the method `wrap_err` exists for enum `Result<(), tauri::Error>`, but its trait bounds were not sa

Michał Sidor 1 Nov 25, 2021
This library provides a stable polyfill for Rust's Strict Provenance experiment.

This library provides a stable polyfill for Rust's Strict Provenance experiment.

Aria Beingessner 57 Nov 15, 2022
Error propagation tracing in Rust.

Propagate Error propagation tracing in Rust. Why Propagate? Being able to trace the cause of an error is critical for many types of software written i

Ben Reeves 10 Sep 23, 2021
A fancy diagnostics & error reporting crate

A fancy diagnostics & error reporting crate

Joshua Barretto 1.1k Dec 30, 2022
Better error messages for axum framework.

axum-debug This is a debugging crate that provides better error messages for axum framework. axum is a great framework for developing web applications

Eray Karatay 3 Feb 3, 2022
A lean, minimal, and stable set of types for color interoperation between crates in Rust.

This library provides a lean, minimal, and stable set of types for color interoperation between crates in Rust. Its goal is to serve the same function that mint provides for (linear algebra) math types.

Gray Olson 16 Sep 21, 2022