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

No new messages since --after MESSAGE_ID should be considered a warning and exit status should be zero #1327

Open
4 of 6 tasks
ldmosquera opened this issue Dec 18, 2024 · 2 comments
Labels

Comments

@ldmosquera
Copy link

Version

v2.44

Flavor

CLI (Command-Line Interface)

Platform

Docker / Linux

Export format

JSON

Steps to reproduce

  1. export --after MESSAGE_ID for a channel that has no new messages since given ID
  2. exit code is non-zero even though this isn't strictly an error condition

Details

I am using the --after flag to do incremental scraping, passing the last message ID seen in previous runs to get only new messages since then.

The problem is that no new messages results in non-zero exit status, indistinguishable from other more serious errors without resorting to brittle parsing of console output.

A saner behavior would be to treat this as a warning instead of an error, and exit with zero status instead, so that external scripting of the CLI can be simple and reliable.

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that this bug is reproducible on the latest version of the application
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project
  • I have not read any of the above and just checked all the boxes to submit the issue
@ldmosquera ldmosquera added the bug label Dec 18, 2024
@ldmosquera
Copy link
Author

Specifically, I'm suggesting this check be relaxed; if there's nothing to do then that isn't strictly a reason to throw an exception, and logging a warning should be enough feedback.

if (request.After is not null && !request.Channel.MayHaveMessagesAfter(request.After.Value))

@Tyrrrz
Copy link
Owner

Tyrrrz commented Dec 19, 2024

Not saying I'm 100% for or against an error here, but my logic was as follows:

  1. The command is meant to produce a file that contains messages from the specific channel
  2. If the channel is empty, there are no messages to write to the file
  3. Therefore the file is not created
  4. As creating the file is the primary purpose of the command, it's considered an error if it cannot reach that result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants