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 #245

Closed
ChristopherRabotin opened this issue Jun 17, 2023 · 2 comments · Fixed by #300
Closed

Improve error handling #245

ChristopherRabotin opened this issue Jun 17, 2023 · 2 comments · Fixed by #300

Comments

@ChristopherRabotin
Copy link
Member

ChristopherRabotin commented Jun 17, 2023

There are currently a few spots in the code where we check that the input f64 is finite. If not, the function will panic (on purpose).

This is potentially catastrophic for flight critical systems. Instead, the code should return a Result for all of the functions that may fail.

Moreover, when using the epoch formatter, the errors should be incredibly clear, similarly to how good the errors are in rustc. It seems that the snafu library could handle this pretty well, so I should explore using snafu. Snafu supports no-std environments, even with Backtraces, so it may be worth using it instead of thiserror which is std-only.

Cf. kube-rs/kube#453

@ChristopherRabotin
Copy link
Member Author

This should include exporting the exception types to Python so that they can be caught without a bare exception (this upsets ruff).

@ChristopherRabotin
Copy link
Member Author

I can't seem to figure out how to derive from BaseException. As such, the "fix" for the Python bare exception ruff error is simply to not use a bare exception and use except Exception as e instead (which is not in fact a bare exception).

Cf. PyO3/pyo3#4165

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

Successfully merging a pull request may close this issue.

1 participant