Adapt UserController example to current ServerRequestObservationContext
See gh-30013
This commit is contained in:
parent
96ae03b48f
commit
362e189aa5
|
@ -28,7 +28,7 @@ public class UserController {
|
||||||
@ExceptionHandler(MissingUserException.class)
|
@ExceptionHandler(MissingUserException.class)
|
||||||
ResponseEntity<Void> handleMissingUser(ServerWebExchange exchange, MissingUserException exception) {
|
ResponseEntity<Void> handleMissingUser(ServerWebExchange exchange, MissingUserException exception) {
|
||||||
// We want to record this exception with the observation
|
// We want to record this exception with the observation
|
||||||
ServerRequestObservationContext.findCurrent(exchange)
|
ServerRequestObservationContext.findCurrent(exchange.getAttributes())
|
||||||
.ifPresent(context -> context.setError(exception));
|
.ifPresent(context -> context.setError(exception));
|
||||||
return ResponseEntity.notFound().build();
|
return ResponseEntity.notFound().build();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue