Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestAndResponseFilter should supply a mechanism for intentionally triggering error handling behavior #71

Open
nicmunroe opened this issue Aug 25, 2017 · 1 comment

Comments

@nicmunroe
Copy link
Member

Currently, when RequestFilterHandler executes RequestAndResponseFilters, any exceptions thrown by the filter are logged with an error-level log message saying filters should never throw exceptions and the exception is then ignored.

This decision was made under the assumption that bad filters shouldn't cause your application to stop functioning, however this prevents filters from triggering the riposte error handling logic to take advantage of the common error contract and error handling behaviors. There are some use cases where this would be desirable.

Some solution should be implemented to allow filters to intentionally trigger error handling. Maybe a default boolean shouldSwallowExceptions() method on RequestAndResponseFilter that lets you choose on a per-filter basis whether thrown exceptions should be swallowed or allowed to trigger error handling? Or maybe a more flexible default boolean shouldSwallowException(Throwable t) where you can choose to swallow some errors and trigger error handling with others? We might also want to reconsider the default behavior and switch to having filters trigger error handling by default, and require filters to override the method if they want the swallow behavior instead. Hard to know which is the more common use case.

@nicmunroe
Copy link
Member Author

For default behavior, maybe a select few exception types (i.e. ApiException) are allowed to trigger error handling under the assumption that they are intentional, and everything else gets swallowed under the assumption that it's a mistake? Not sure whether that would be confusing or helpful.

Whatever the end result, we should make sure RequestAndResponseFilter's javadocs are properly updated to call out the issue and explain how things work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant