Skip to content

error-stack: beginner question "confusing backtrace" #3225

Discussion options

You must be logged in to vote

I produced a minimal example to simulate your behavior. To make it a little bit easier to deal with the different error kinds I used thiserror and a single enum:

#[derive(Debug, thiserror::Error)]
pub enum SerialError {
    #[error("Can't open new serial AT modem.")]
    Open,
    #[error("Can't set flow control.")]
    FlowControl,
    #[error("Can't execute AT command.")]
    AtCommand,
    #[error("Can't flush serial buffer.")]
    Flush,
    #[error("Simulated Broken connection.")]
    Broken,
}

Given your description of the causes:

  • creating a new AT modem struct,
  • caused by new()/init() not being able to initialize flow control
  • caused by the at command failing to set flow control
  • ca…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@kwinz
Comment options

@TimDiekmann
Comment options

Answer selected by kwinz
@kwinz
Comment options

@TimDiekmann
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area)
2 participants