Exposes all root causes to ExceptionHandler methods
Closes gh-28155
This commit is contained in:
@@ -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.
|
||||
@@ -82,9 +82,10 @@ public class ControllerAdviceTests {
|
||||
|
||||
@Test
|
||||
public void resolveExceptionWithAssertionErrorAsRootCause() throws Exception {
|
||||
AssertionError cause = new AssertionError("argh");
|
||||
FatalBeanException exception = new FatalBeanException("wrapped", cause);
|
||||
testException(exception, cause.toString());
|
||||
AssertionError rootCause = new AssertionError("argh");
|
||||
FatalBeanException cause = new FatalBeanException("wrapped", rootCause);
|
||||
Exception exception = new Exception(cause);
|
||||
testException(exception, rootCause.toString());
|
||||
}
|
||||
|
||||
private void testException(Throwable exception, String expected) throws Exception {
|
||||
|
||||
@@ -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.
|
||||
@@ -138,7 +138,7 @@ class RequestMappingExceptionHandlingIntegrationTests extends AbstractRequestMap
|
||||
|
||||
@GetMapping("/thrown-exception-with-cause-to-handle")
|
||||
public Publisher<String> handleAndThrowExceptionWithCauseToHandle() {
|
||||
throw new RuntimeException("State", new IOException("IO"));
|
||||
throw new RuntimeException("State1", new RuntimeException("State2", new IOException("IO")));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/mono-error")
|
||||
|
||||
Reference in New Issue
Block a user