my attempt at compromise between unwrapping and bullying my dependencies' authors for Error impl

Overview

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 satisfied
   --> src/main.rs:60:6
    |
60  |     .wrap_err("error while running tauri application")?;
    |      ^^^^^^^^
    |
   ::: /home/michcioperz/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.0.0-beta.8/src/error.rs:10:1
    |
10  | pub enum Error {
    | --------------
    | |
    | doesn't satisfy `tauri::Error: Sync`
    | doesn't satisfy `tauri::Error: eyre::context::ext::StdError`
    |
   ::: /home/michcioperz/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:503:1
    |
503 | pub enum Result<T, E> {
    | --------------------- doesn't satisfy `_: WrapErr<(), tauri::Error>`
    |
    = note: the following trait bounds were not satisfied:
            `tauri::Error: eyre::context::ext::StdError`
            which is required by `Result<(), tauri::Error>: WrapErr<(), tauri::Error>`
            `tauri::Error: Sync`
            which is required by `Result<(), tauri::Error>: WrapErr<(), tauri::Error>`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `app` due to previous error

Sometimes you feel very tired and decide that, okay, perhaps I will need to stringify the error:

    .map_err(|e| e.to_string())

And that works okay, unless the error doesn't stringify, at which point you grow angrier and just:

    .map_err(|e| format!("{:?}", e))

But String isn't actually an error type, so eyre rightfully doesn't see it as such, so you actually want:

    .map_err(|e| eyre!("{:?}", e))

And probably more people should scream at me, but I'd like to have shorthands for this where I don't type this heresy over and over again, but instead write:

    .debug_to_eyre()
You might also like...
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.

Easy switch between AWS Profiles and Regions
Easy switch between AWS Profiles and Regions

AWSP - CLI To Manage your AWS Profiles! AWSP provides an interactive terminal to interact with your AWS Profiles. The aim of this project is to make i

This crate bridges between gstreamer and tracing ecosystems.

This crate provides a bridge between gstreamer and the tracing ecosystem. The goal is to allow Rust applications utilizing GStreamer to better integra

Simple interoperability between C++ coroutines and asynchronous Rust

cxx-async Overview cxx-async is a Rust crate that extends the cxx library to provide seamless interoperability between asynchronous Rust code using as

Count and convert between different indexing schemes on utf8 string slices

Str Indices Count and convert between different indexing schemes on utf8 string slices. The following schemes are currently supported: Chars (or "Unic

A translator interface between VoiceMeeter/VBAN and the X-Touch

VBAN - XCtrl translator This serves as a network based translator for interfacing the Behringer X-Touch with VoiceMeeter Potato. It is designed to ru

Create virtual serial ports, connect them to physical serial ports, and create routes between them all.

Virtual Serial Port Router (vsp-router) Create virtual serial ports, connect them to physical serial ports, and create routes between them all. vsp-ro

Get a diff between two OpenAPI descriptions.

Get the difference between two OpenAPI descriptions.

A compatibility layer to smooth the transition between different versions of embedded-hal

Embedded HAL Compatibility Layer A compatibility layer to smooth the transition between different versions of embedded-hal (specifically 0.2.x and 1.0

Owner
Michał Sidor
Contact me if you need anything from the archived repos
Michał Sidor
Error context library with support for type-erased sources and backtraces, targeting full support of all features on stable Rust

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.

Findora Foundation 1 Feb 12, 2022
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
A fancy diagnostics & error reporting crate

A fancy diagnostics & error reporting crate

Joshua Barretto 1.1k Dec 30, 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
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
Another attempt at creating a wrapper for fastcdc in node.js

Another attempt at creating a wrapper for fastcdc in node.js. This time using wasmbindgen instead of neon.

Mikola Lysenko 5 Jul 28, 2022
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

Noam Ta Shma 20 Aug 3, 2022
Detect and remove unused dependencies from Cargo.toml

Cargo Shear ✂️ ?? Detect and remove unused dependencies from Cargo.toml in Rust projects. Installation cargo binstall cargo-shear # OR cargo install c

Boshen 49 Jul 25, 2024
Keep your dependencies up-to-date

Deps.rs - Dependency status at a glance Deps.rs is a service that shows you at a glance if any of your dependencies are out of date or insecure. This

deps.rs 369 Jan 5, 2023