Throw 500
and 501
errors for missing or invalid handlers in SCIMMY.Resources.User
and SCIMMY.Resources.Group
#40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the read, write, and patch methods of the
SCIMMY.Resources.User
andSCIMMY.Resources.Group
classes pass return values from declared ingress/egress/degress handlers directly to their corresponding schema classes for instantiation. When these handlers are either missing, or do not return expected values, the schema class constructor will throw aTypeError
exception, as it expects the supplied value to be an object. ThisTypeError
exception is then rethrown as aSCIMError
exception withstatus
andscimType
properties of values400
andinvalidValue
respectively, indicating an issue with the request, which is technically incorrect.This change updates the default
ingress
,egress
, anddegress
handlers for theUser
andGroup
resource classes to throw a501 Not Implemented
exception (fixes #39). It also updates the theread
andwrite
methods of these classes to throw a500 Internal Server Error
when handler implementations return invalid or empty values that cannot be coerced into schema-compliant values (fixes #39). Additionally, thepatch
method of these classes have been updated to call the classread
andwrite
methods to leverage the aforementioned exception handling, instead of calling ingress/egress handlers themselves (fixes #39). Thepatch
methods have also been updated to require they are only able to be called for a specific resource, instead of for a list of resources. The test fixtures in the resources hooks have been updated to verify the correct exceptions are being thrown, and that thepatch
method now requires a specific resource.