better error handling and internals
in this MR
- all
unwrap
s andexpect
s have been removed from any.rs
module that is notmain.rs
=> the goal is to never panic from inside the library and letmain.rs
handle the errors - in
main.rs
the newthrow_error
function is used to return a message onstderr
and exit the runtime with a code => thenkomodo.nu
picks it up and gives a nicer error to the user - the internals of
komodo.nu
also have been greatly simplified without feature changes
Note
becausethrow_error
does not return anything and some of the places where there might be errors inmain.rs
need to return a value, someunwrap_or_else
need to have anunreachable!
statement in them to show the compiler it's ok if there's no value on theErr
branchit would be nice to find a better way of doing this
🤔