The middleware's catch block does not get triggered when errors occur in a controller that extends a ServiceEndpoint
.
#7027
Answered
by
VictorTomaili
EdwinThomas11
asked this question in
Help
-
public async Task Invoke(HttpContext context) If "ServiceEndpoint" is removed from the controller then the catch block is getting triggered. |
Beta Was this translation helpful? Give feedback.
Answered by
VictorTomaili
Dec 6, 2023
Replies: 1 comment 4 replies
-
@volkanceylan @VictorTomaili please help here. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
ServiceEndpoint
has anHandleServiceExceptionAttribute
applied to it. This attribute inherits fromExceptionFilterAttribute
. The filter catches exceptions in the inner scope. This means that if the controller scope has such an attribute or filter that handles the exception, the middleware or other ways of handling exceptions provided by ASP.NET may not be used. The filter takes the exception, deals with it according to the logic in the filter, and may stop it from going up to the higher levels of the application where middleware could handle it otherwise.