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

improve error handling #187

Open
mufunyo opened this issue Jul 13, 2022 · 4 comments · May be fixed by #203
Open

improve error handling #187

mufunyo opened this issue Jul 13, 2022 · 4 comments · May be fixed by #203
Assignees
Labels
enhancement New feature or request

Comments

@mufunyo
Copy link

mufunyo commented Jul 13, 2022

Because the archiver script crashes so often, I made a simple Bash script that retries the archiver infinitely until it returns 0. However, this morning I was greeted with "Error while loading camera list: 404" while the script exited "successfully". All errors should return something other than 0 to prevent this from happening.

@danielfernau
Copy link
Owner

Hey there, thanks for opening this issue.

The tool already returns non-zero exit codes for multiple different kinds of exceptions - let's see what I can do to improve exit- and error handling for this camera list 404 situation...

If you like you can post a bit more information about your crashes here (please remove/redact personal info from logs first) so that I can have a look and maybe add some improvements here and there to the tool for everyone's benefit...

@danielfernau danielfernau added enhancement New feature or request question Further information is requested labels Jul 13, 2022
@mufunyo
Copy link
Author

mufunyo commented Jul 17, 2022

The tool already returns non-zero exit codes for multiple different kinds of exceptions - let's see what I can do to improve exit- and error handling for this camera list 404 situation...

Maybe a simple solution is just to have the archiver return the HTTP status code? So in this case it would return 404 instead of 0.

If you like you can post a bit more information about your crashes here (please remove/redact personal info from logs first) so that I can have a look and maybe add some improvements here and there to the tool for everyone's benefit...

Here you go: https://gist.githubusercontent.com/mufunyo/67b33fc52b224dd58b85b74c83ffa3b1/raw/f275c7b1385d20d6a8ae433ff7e4e9a98cee8382/archiver.log

If it's not too much to ask, suppressing the Python exception handler and just printing human-readable errors would already help immensely. Even a simple timeout pukes the entire terminal full of traceback and pushes any previous statuses outside of scrollback.

@danielfernau danielfernau self-assigned this Jul 17, 2022
@danielfernau danielfernau removed the question Further information is requested label Jul 17, 2022
@danielfernau danielfernau changed the title 404 error returns 0 (success) improve error handling Jul 17, 2022
@danielfernau
Copy link
Owner

Alright, @mufunyo, thanks for the logs and your input. I can implement both ideas.

As to why stuff like this is sometimes not already included and also why it sometimes takes a considerable amount of days before I add or fix something: this is a personal weekend project of mine which I decided to open-source here for everyone to use, build upon, or make improvements to by means of a pull request or by opening an issue. I can only work on it if my schedule allows, and it's definitely not intended a 'perfect solution' by any means to a problem that IMHO shouldn't exist in the first place since UI advertises their appliances as 'business-grade network video recorder'...

But long story short, below is my task list - you'll be notified once the features are implemented as well as when the next version is available :)


ToDo

  • return HTTP Status Code as exit code on error
  • improve error logging to console (hide tracebacks unless --verbose command line option is provided)

@mufunyo
Copy link
Author

mufunyo commented Jul 17, 2022

Oh I understand and agree completely. It's an absolute embarrassment that Ubiquiti don't expose a simple archiving function in their own UI, and I get that this is a part time project for you. That's why I didn't reach out before, if I can work around something myself I will, if it means I don't have to bother you with it. However I couldn't work around this particular issue (not without regex parsing stdout/stderr at least) so I figured I'd open an issue. I'm very grateful that you've built this and I'm looking forward to the improvements you have planned!

@danielfernau danielfernau linked a pull request Aug 16, 2022 that will close this issue
@danielfernau danielfernau linked a pull request Aug 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants