As an example, users may want to throw IllegalArgumentException from their own services.
However, they may want to return a different error code for
IllegalArgumentException from their own services
IllegalArgumentException from armeria's internal validation (i.e. missing param)
|
throw new IllegalArgumentException("Mandatory parameter/header is missing: " + httpElementName); |
We may consider:
- Allowing users to customize the default exception returned from armeria's internal logic
- We need to find a way to think of a way to reflect the default exception mapping to the
DefaultServerErrorHandler
|
if (isAnnotatedService) { |
- Also provide information on where the exception was thrown as a parameter in
ServiceErrrorHandler#onServiceException
- Just wrap all exceptions with a pre-defined Armeria exception
This doesn't necessarily have to be limited to AnnotatedService, but may be also applied to GrpcService, THttpService, GraphQlService, etc.
ref: https://discord.com/channels/1087271586832318494/1087272728177942629/1156905488672379000
As an example, users may want to throw
IllegalArgumentExceptionfrom their own services.However, they may want to return a different error code for
IllegalArgumentExceptionfrom their own servicesIllegalArgumentExceptionfrom armeria's internal validation (i.e. missing param)armeria/core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedValueResolver.java
Line 1038 in d9b6142
We may consider:
DefaultServerErrorHandlerarmeria/core/src/main/java/com/linecorp/armeria/server/DefaultServerErrorHandler.java
Line 65 in d4270da
ServiceErrrorHandler#onServiceExceptionThis doesn't necessarily have to be limited to
AnnotatedService, but may be also applied toGrpcService,THttpService,GraphQlService, etc.ref: https://discord.com/channels/1087271586832318494/1087272728177942629/1156905488672379000