Skip to content

Commit

Permalink
Add note about CDI interceptors and @ServerExceptionMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Mar 20, 2024
1 parent 966063b commit 71a139f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/src/main/asciidoc/rest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2242,8 +2242,16 @@ public class Endpoint {
}
----

NOTE: exception mappers defined in REST endpoint classes will only be called if the
exception is thrown in the same class. If you want to define global exception mappers,
[TIP]
====
By default, methods annotated with `@ServerExceptionMapper` do **not** run CDI interceptors that apply to the other methods of the class (like ones needed for implementing security method level security).
Users however can opt into interceptors by adding the corresponding annotations to the method.
====

[NOTE]
====
Εxception mappers defined in REST endpoint classes will only be called if the exception is thrown in the same class. If you want to define global exception mappers,
simply define them outside a REST endpoint class:
[source,java]
Expand All @@ -2262,6 +2270,7 @@ class ExceptionMappers {
----
You can also declare link:{jaxrsspec}#exceptionmapper[exception mappers in the Jakarta REST way].
====

Your exception mapper may declare any of the following parameter types:

Check warning on line 2275 in docs/src/main/asciidoc/rest.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsWarnings] Consider using 'might (for possiblity)' or 'can (for ability)' rather than 'may' unless updating existing content that uses the term. Raw Output: {"message": "[Quarkus.TermsWarnings] Consider using 'might (for possiblity)' or 'can (for ability)' rather than 'may' unless updating existing content that uses the term.", "location": {"path": "docs/src/main/asciidoc/rest.adoc", "range": {"start": {"line": 2275, "column": 23}}}, "severity": "WARNING"}

Expand Down

0 comments on commit 71a139f

Please sign in to comment.