Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
Handle almost all errors as errors, instead of causing a panic
Merged liw opened 1 year ago

Instead of calling Result::unwrap or Result::expect, which panic if the result is not Ok, we return the error to the caller. That will hopefully be logged and thus visible to the user in a way that is easier to deal with than a panic

This leaves only a few JoinHandle::join results that are handled in a way that causes a panic. JoinHandle returns errors that do not implement the std::error::Error trait, which makes them a little harder to handle the way other errors are handled. Specifically, thiserror doesn’t like them as source errors. I’m ignoring the join errors for now.

Every other error is handled. The only unwrap or expect method calls now are for the join errors or for Options.

Signed-off-by: Lars Wirzenius liw@liw.fi

liw opened with revision fbe7879a on base 4acabd5f +289 -184 1 year ago

Instead of calling Result::unwrap or Result::expect, which panic if the result is not Ok, we return the error to the caller. That will hopefully be logged and thus visible to the user in a way that is easier to deal with than a panic

This leaves only a few JoinHandle::join results that are handled in a way that causes a panic. JoinHandle returns errors that do not implement the std::error::Error trait, which makes them a little harder to handle the way other errors are handled. Specifically, thiserror doesn’t like them as source errors. I’m ignoring the join errors for now.

Every other error is handled. The only unwrap or expect method calls now are for the join errors or for Options.

Signed-off-by: Lars Wirzenius liw@liw.fi

liw merged revision fbe7879a at 0a8925d9 1 year ago