Skip to content

Commit

Permalink
Log unhandled external errors at default error interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Jan 29, 2024
1 parent b94f36f commit 3a74f65
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ballerina/http_interceptors.bal
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// under the License.

import ballerina/jwt;
import ballerina/log;

# The HTTP request interceptor service object type
public type RequestInterceptor distinct service object {
Expand Down Expand Up @@ -57,6 +58,9 @@ service class DefaultErrorInterceptor {
*ResponseErrorInterceptor;

remote function interceptResponseError(error err, Request request) returns Response {
if err !is InternalError {
log:printError("unhandled error returned from the service", err, path = request.rawPath, method = request.method);
}
return getErrorResponseForInterceptor(err, request);
}
}
Expand Down

0 comments on commit 3a74f65

Please sign in to comment.