Skip to content

Conversation

@TOFarmer
Copy link
Contributor

@TOFarmer TOFarmer commented Feb 6, 2021

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:

  • 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.

@TOFarmer TOFarmer added the Feature Issues or MRs that add, improve or maintain features label Feb 6, 2021
@TOFarmer TOFarmer self-assigned this Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issues or MRs that add, improve or maintain features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable custom exception messages to be raised from SAL Server

2 participants