Open TOFarmer opened 3 years ago
Another example of when this would be useful already exists when using POST:
InvalidRequest('Could not de-serialise content.')
is raised.Branch
or DataObject
, the InvalidRequest
message is 'Content does not describe a Branch or DataObject'
.In the current handling of exception neither or these messages would be passed to the user.
Description
The Flask implementation of the SAL server relies on all exception types (and their messages) being defined when the server is initialised. This means that context specific messages (i.e. origin of the exception) cannot be returned to the client.
Suggested fix
Remove the server
error_map
and subclassflask_restful.Api
to provide the ability to return custom exception messages.Additional context
Although commonly a generic exception message (i.e.
NodeNotFound: The supplied path does not point to a valid node.
) will be sufficient for the client, occasionally additional context will be beneficial. For example, if the SAL server is interacting with a backend with a large number of exception types, there will be a many-to-one mapping to SAL exception types; in this instance being able to communicate the specific backend error message to the user could be useful.