Enables the SAL server to respond with custom exceptions messages i.e., if a SAL exception is initialised with a message (e.g. NodeNotFound('This is a custom message'), that message will be displayed in the client.
This required:
Adding a SALHTTPException which subclasses werkzeug.exception.HTTPException as well as SALException. This allows any classing inheriting from SALHTTPException to define a code (HTTP status code) and a description.
Changed from using flask_restful.Api to a subclass which customises exception handling by the Api.
Removing the error_map which was passed to flask_restful.Api.
Fixes
Fixes #46
To test
[ ] Ensure that the exceptions which derive from SALHTTPException have the correct code values.
[ ] Create a simple SAL server (i.e., just define a simple PersistenceProvider) and test that it can respond with custom exception messages.
[ ] Check that standard exception messages are still returned if a custom exception message is not provided (i.e., if an exception is initialised without a message).
[ ] Check that the changes are sufficiently documented.
Description
Enables the SAL server to respond with custom exceptions messages i.e., if a SAL exception is initialised with a message (e.g.
NodeNotFound('This is a custom message')
, that message will be displayed in the client.This required:
SALHTTPException
which subclasseswerkzeug.exception.HTTPException
as well asSALException
. This allows any classing inheriting from SALHTTPException to define acode
(HTTP status code) and adescription
.flask_restful.Api
to a subclass which customises exception handling by theApi
.error_map
which was passed toflask_restful.Api
.Fixes
Fixes #46
To test
code
values.