Skip to content

better error handling and internals

STEVAN Antoine requested to merge better-error-handling into main

in this MR

  • all unwraps and expects have been removed from any .rs module that is not main.rs => the goal is to never panic from inside the library and let main.rs handle the errors
  • in main.rs the new throw_error function is used to return a message on stderr and exit the runtime with a code => then komodo.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
because throw_error does not return anything and some of the places where there might be errors in main.rs need to return a value, some unwrap_or_else need to have an unreachable! statement in them to show the compiler it's ok if there's no value on the Err branch

it would be nice to find a better way of doing this 🤔

Merge request reports