Questions tagged [thiserror]
9 questions
8
votes
1 answer
How do I print a backtrace without panicking using thiserror?
I am running a Rust warp webserver and I need more descriptive error messages. I'd like to print a backtrace or something similar so I can tell where the error started.
I was using the Failure crate, but it is now deprecated so I migrated to…

Marty
- 1,077
- 1
- 10
- 14
3
votes
1 answer
Does thiserror ship an unstable feature so that it does not work with stable rust release?
I am working on this repo. It builds with no problem on MacOS on a M2 Laptop; but when I try to build it on a Debian desktop, it shows this error:
error[E0554]: `#![feature]` may not be used on the stable release channel
-->…

chunjiw
- 1,093
- 9
- 20
2
votes
2 answers
Error handling for applications: how to return a public message error instead of all the chain of errors and tracing it at the same time?
PROLOGUE
I'm using async-graphql and I have hundreds of resolvers and for each resolver I would like to trace all the possible errors.
In each method of my app I'm using anyhow::{Error}.
Right now I have code similar to this for each…

Fred Hors
- 3,258
- 3
- 25
- 71
2
votes
1 answer
Reuse error message from `thiserror` definition
I use thiserror crate for error handling inside my project.
I declare an error like this
#[derive(Debug, thiserror::Error)]
enum CustomErrors {
#[error("This is custom error one")]
CustomErrorOne,
#[error("This is custom error two")]
…

Roman Mahotskyi
- 4,576
- 5
- 35
- 68
0
votes
1 answer
Rust error handling - why does this give different output?
I'm having trouble getting miette to give consistent output.
I'd expect the program below to give the same output whether I pass in "good" (which gives the fancy formatting I want) or "bad" (which prints a more debug-like error message), but one way…

John Graham
- 135
- 6
0
votes
0 answers
Is `thiserror` impossible to use in stable Rust?
Using a dependency like
eframe = "0.20.1"
I'm running into compilation errors because of it's dependency
Compiling thiserror v1.0.38
lib.rs
`#![feature]` may not be used on the stable release channel
It is because of this…

Lukas
- 391
- 4
- 11
0
votes
1 answer
How to use thiserror to forward an error with a generic type parameter
Learning Rust, I am using the thiserror crate to wrap some exceptions.
This is the exception I want to wrap from the unrar crate:
#[derive(PartialEq)]
pub struct UnrarError {
pub code: Code,
pub when: When,
pub data: Option,
}
My…

caprica
- 3,902
- 4
- 19
- 39
0
votes
0 answers
Compilation when trying to convert error from an external crate into my custom error type with `thiserror`
I am trying to use the thiserror crate to convert an error into my custom error but I am getting this compilation error message. The error I am trying to implement is the MiddlewareError from the Ethers-rs crate. Below is the compilation error I am…

0xKitsune
- 131
- 6
0
votes
1 answer
Issue with a `String` and `thiserror`: `as_dyn_error` exists for reference `&String`, but its trait bounds were not satisfied` in Rust
This is my first attempt to using thiserror in Rust. One of the error types I want to provide is a general string which has a message but no other fields. I've attempted to copy this from the thiserror docs, with the only exception being the use of…

Migwell
- 18,631
- 21
- 91
- 160