jonhoo / jonhoo/rust-imap

Make imap panic free

Open
#230 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
583
Forks
94
PR merge metrics
No merged PRs in 30d

Description

There's a lot of pain in dealing with panic from lib, especially working with background services.

At least I'd like to remove panics came across with tag asserts (#229 #211).

How about turn [`assert_eq!(tag.as_bytes(), match_tag.as_bytes());`](https://github.com/jonhoo/rust-imap/blob/db2911746358741a74f9dda8b2eecbf480506224/src/client.rs#L1396) to a new [imap](https://docs.rs/imap/latest/imap/index.html)::[error](https://docs.rs/imap/latest/imap/error/index.html)::[Error](https://docs.rs/imap/latest/imap/error/enum.Error.html) variant `Fatal(FatalError)` with some fatal error flag like `FatalErrorOccurred: bool`, and check `FatalErrorOccurred` flag before any `run_command()`?

`FatalError` could be like this:

```rust
enum FatalError{
TagBroken,
Other,
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.