rsRustPrimer
< Back to modules

Error handling

Option, Result and the ? operator: errors visible in the types, no exceptions.

  1. 1
    panic! and unrecoverable errorsWhen to stop the program, and why unwrap is a confession.
  2. 2
    The Result typeOk or Err: an error that is part of the signature.
  3. 3
    The ? operatorPropagate an error in a single character.
  4. 4
    Typed errorsAn enum of business errors, printable and usable.
  5. ◆
    Project: load a portfolioRunning projectRead a CSV of trades with typed, line-numbered errors, without a single panic.