Skip to content

propagate panics as errors to callers #35

Closed
@2bndy5

Description

@2bndy5

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions