Skip to content

Commit

Permalink
Handle gracefully unknown error codes
Browse files Browse the repository at this point in the history
Do not throw exceptions for unknown error codes. If
`get_proc_exception()` gets called from within an exception context and
raises an exception itself, then this exception will not get caught, and
it will get lost.

Prefer instead to return an exception class that we have for this
purpose, and show to the user the unknown error code of the converesion
process.
  • Loading branch information
apyrgio committed Feb 20, 2024
1 parent aeb8c33 commit e73f10f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dangerzone/conversion/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ def exception_from_error_code(
for cls in ConversionException.get_subclasses():
if cls.error_code == error_code:
return cls()
raise ValueError(f"Unknown error code '{error_code}'")
return UnexpectedConversionError(f"Unknown error code '{error_code}'")

0 comments on commit e73f10f

Please sign in to comment.