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

Return Value When Lookup Fails Is The Same As Return Value When No Campsites Found #33

Open
mlgold opened this issue Jun 1, 2021 · 2 comments

Comments

@mlgold
Copy link

mlgold commented Jun 1, 2021

About 5% of the time the lookup fails, due to the website being busy and returns an error. If I recall correctly, this throws an exception and the return value is also 1. Since the output of the program clearly lists success or failure, it is not necessary to return 1 if no campsites are found and 0 if campsites are found. I changed it to always return 0 and if it fails and throws an exception, i have a shell script that tries a second time after a few seconds. Otherwise as busy times, it will not find campsites.

@banool
Copy link
Owner

banool commented Jun 4, 2021

This is so I know whether to run the notifier or not. In reality this is real janky and it should only return non zero when it actually fails, you're totally right, and in other cases returns json or something. I'd accept a PR to change this.

@mmallozzi
Copy link

It would be a nice change to have different return codes for the different scenarios - it's common for 0 to indicate success, 1 might be more of an "expected" failure (like not finding sites), and then >1 for various unexpected errors (like network failures, or illegal arguments, things like that). I'm currently setting this up in a cronjob but aiming to monitor the cron's health with something like cronitor.io, and it makes it difficult to distinguish between the expected and unexpected cases.

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

No branches or pull requests

3 participants