Skip to content

Add ability to surface general exceptions that are captured #23

@rreinhardt9

Description

@rreinhardt9

Currently in the code, we rescue all exceptions and provide a custom JSON response for the 500 error:

rescue_from StandardError do
json_response(
{
schemas: ["urn:ietf:params:scim:api:messages:2.0:Error"],
status: "500"
},
:internal_server_error
)
end

The catch is, that leaves the host system unaware of the exception. Since the exception was caught it doesn't bubble up to the parent system to be caught by it's error handling system.

From what I understand, it's also not possible to both render a response and raise an exception.

What if, we expose the ability to configure a "callable" in an initializer that will be called with the given exception in the event that one is rescued?

For example, the proc could be a call to Honeybadger:

# In host app initializer

ScimRails.configure do |config|
  config.error_handler = -> (e){ Honeybadger.notify(e) }
end

By default, we could potentially make it a call to the rails logger so that "silence" is not the default:

-> (e) { Rails.logger.error(e.inspect) }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions