ErrorResponse support in Spring MVC exception hierarchy

All Spring MVC exceptions from spring-web, now implement ErrorResponse
and expose HTTP error response information, including an RFC 7807 body.

See gh-27052
This commit is contained in:
rstoyanchev
2022-02-25 11:38:00 +00:00
parent 3efedef161
commit 76be6373a8
22 changed files with 230 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ public class DispatcherHandlerErrorTests {
StepVerifier.create(mono)
.consumeErrorWith(ex -> {
assertThat(ex).isInstanceOf(ResponseStatusException.class);
assertThat(ex.getMessage()).isEqualTo("404 NOT_FOUND \"No matching handler\"");
assertThat(ex.getMessage()).isEqualTo("404 NOT_FOUND");
})
.verify();