Skip to content
Snippets Groups Projects
Commit 016cb2dd authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

better error handling and internals (dragoon/komodo!17)

in this MR
- all `unwrap`s and `expect`s 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 :thinking:
parent e19e3d77
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment