intility / intility/json-api-toolkit
JsonApiExceptionFilter overrides app-defined exception filters
@erlendellefsen is already working on this.
Since Aug 20, 2026.
- Dominant language
- C#
- Stars
- 7
- Forks
- 0
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 23
Description
Problem
JsonApiExceptionFilter is applied controller-scoped via [ServiceFilter] on JsonApiController with the default Order = 0. Its else branch handles any exception (mapping unknown types to 500) and sets ExceptionHandled = true.
Because it competes at the same scope and order as user-defined exception filters, it can win the tie and run first. When it does, the app's own IExceptionFilter never runs and is silently overridden, with no warning.
Expected
A catch-all should be a last-resort fallback, not a first responder. App-defined exception filters should get first chance to handle an exception; only genuinely unhandled exceptions should fall through to the toolkit.
Suggested fix
Make the catch-all run last among exception filters (their execution order is inverted, so int.MinValue runs last):
[ServiceFilter(typeof(JsonApiExceptionFilter), Order = int.MinValue)]
public abstract class JsonApiController : ControllerBase
Non-breaking: handling of JsonApiException is unchanged; apps with no custom exception filter see no difference.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.