Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit with a non-zero exit status if a given mail does not exist #265

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nmeum
Copy link
Contributor

@nmeum nmeum commented Oct 8, 2024

Sadly, the diff is quite large as we will have to change the API of blaze822_loop to differentiate the number of processed messages and a status code indicating a missing mail. Note that currently execution is not aborted upon encountering the first non-existent mail; hence, we can't do both via the return value.

Surprisingly, very few utilities actually use the number of processed messages as returned by blaze822_loop. Therefore, we could reduce the diff quite a bit by differentiating the two use cases through separate functions (e.g. blaze822_loop and blaze822_loop_num), which would allow the API of blaze822_loop to remain largely unchanged.

The new blaze822_loop API would also allow us to improve error handling for blaze822_seq_next but I haven't done this so far…

There are also some tests, but these should be expanded.

Fixes #264

@nmeum
Copy link
Contributor Author

nmeum commented Oct 8, 2024

Hacked this together rather quickly, let me know if you think it is worthwhile to peruse this approach further or if you prefer an alternative design.

@leahneukirchen
Copy link
Owner

I think it should keep going, anyway (compare cp(1) e.g.)

As only mscan and mpick use the count for informative messages, perhaps we could count in the callback instead...

@nmeum nmeum force-pushed the mblaze-error-handling branch from 900863b to 89e7d05 Compare October 13, 2024 11:03
@nmeum
Copy link
Contributor Author

nmeum commented Oct 13, 2024

As only mscan and mpick use the count for informative messages, perhaps we could count in the callback instead...

Good idea, updated accordingly. Let me know what you think

nmeum added 3 commits October 13, 2024 17:30
Callers which need the number of messages processed need to count
in the callback function now, see the previous commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

non-existent mail arguments are silently discarded
2 participants