Closed dignifiedquire closed 3 years ago
Not sure, I am still very new to rust and unsure of tgr best way for a library to handle and expose errors.
I asked earlier at #rust-fr how people do it; someone answered that most of the time we create an enum to use as the Err part of a Result. They also told me libraries exist to avoid this boilerplate, but I don't think we need it for now (not many error sources).
I think here we could just use Result<blah, String>
, and return Err(format!{"{:?"}, error_from_nom */ })
most of the time, and an enum otherwise. eg. for decapsulate
: enum DecapsulateError { ParseError(String), ProtocolNotFound }
.
I am closing here as (a) the discussion has stalled and (b) I would say error handling is in a good state. Please comment in case you think otherwise.
What improvements do you want to do?