Skip to content

Commit

Permalink
Fix getting an exception (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstepanov authored Nov 22, 2024
1 parent 5645150 commit 8012d42
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ static String sanitizePath(@Nullable String path) {
* @param httpResponse the HTTP response
*/
public void onResponse(HttpResponse<?> httpResponse) {
Throwable throwable = httpResponse.getAttribute(HttpAttributes.EXCEPTION, Throwable.class).orElse(null);
if (throwable != null) {
// Avoid using the conversion service for exceptions
Object exception = httpResponse.getAttribute(HttpAttributes.EXCEPTION).orElse(null);
if (exception instanceof Throwable throwable) {
RouteMatch<?> routeMatch = httpResponse.getAttribute(HttpAttributes.ROUTE_MATCH, RouteMatch.class).orElse(null);
if (routeMatch != null && routeMatch.getRouteInfo() instanceof ErrorRouteInfo<?, ?>) {
// Avoid publishing an error on error route
Expand Down

0 comments on commit 8012d42

Please sign in to comment.