Closed
Description
Currently, there are a lot of places where I use Result.expect()
to panic on unexpected behavior. Most notably in RestApiClient.send_api_request()
. It is more idiomatic rust to handle errors in the caller instead of arbitrarily throwing panics.
This solution may be considered a refactor since there are so many instances where the code calls Result.expect()
, or Result.unwrap()
(same as .expect()
but without customized error message).
Note
There are some instances where it makes sense to use .unwrap()
, but it should be determined by the code block's local context.
TBH, this problem was born from the fact that this is my first rust project. I should have picked a more robust design from the start.