jonysy / miro

A modern computer vision platform.
6 stars 1 forks source link

Error handling #1

Closed jonysy closed 7 years ago

jonysy commented 7 years ago

At a glance, it seems that most Rust libraries deal with external errors by wrapping them in a single enum. Wrapping every possible error that could arise is a tedious task.

The std::io module contains an Error struct and an ErrorKind enum. Error::new accepts a Boxable std::error::Error.

I prefer Boxing Errors over wrapping errors using an enum, as the Error trait would allow for propagating an error from a function to the code that calls that function, as a way to trace it back to its origin.

Note: Box allocates memory on the heap.

Useful crates: