Skip to content

Improve DPF Server error handling #2636

@PProfizi

Description

@PProfizi

Description of the feature

The current way DPF server errors are reported by PyDPF-Core is that the error message is put in a DPFServerException as-is.
This is an issue for several server errors which also share a form of server-side traceback or detailed failure information directly within the error message due to the C-layer.

This makes it very hard for front-ends to show user-friendly messages.

The objective is to find a way to separate the three information:

  • a user-friendly readable error message
  • the Python traceback
  • the serve-side "traceback"

Steps for implementing the feature

Insert DPF Server error message parsing logic here to separate between actual message and traceback, with traceback put as note or equivalent additional information property:

Exception.__init__(self, msg)

Warning: BaseException.add_note is only available starting with Python 3.11, meaning we have to find a workaround for 3.10 and less (maybe add a custom property to the Exception object, or create a custom Exception class to copy the add_note behavior.

Useful links and references

https://peps.python.org/pep-0678/
https://docs.python.org/3/tutorial/errors.html#enriching-exceptions-with-notes
https://docs.python.org/3.13/library/exceptions.html#BaseException.add_note

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions