|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2024 the original author or authors. |
| 2 | + * Copyright 2002-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -111,6 +111,19 @@ void leaveUnresolvedViaNullReturnValue() {
|
111 | 111 | StepVerifier.create(resolver.resolveException(ex, this.environment, controller)).verifyComplete();
|
112 | 112 | }
|
113 | 113 |
|
| 114 | + @Test // gh-1090 |
| 115 | + void failureFromResolver() { |
| 116 | + ExceptionThrowingController controller = new ExceptionThrowingController(); |
| 117 | + |
| 118 | + Exception ex = new IllegalArgumentException("Bad input"); |
| 119 | + AnnotatedControllerExceptionResolver resolver = exceptionResolver(); |
| 120 | + resolver.registerController(controller.getClass()); |
| 121 | + |
| 122 | + StepVerifier.create(resolver.resolveException(ex, this.environment, controller)) |
| 123 | + .expectErrorSatisfies(actual -> assertThat(actual).isSameAs(ex)) |
| 124 | + .verify(); |
| 125 | + } |
| 126 | + |
114 | 127 | @Test
|
115 | 128 | void resolveWithControllerAdvice() {
|
116 | 129 | AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
@@ -304,4 +317,14 @@ public String handle(IllegalArgumentException ex) {
|
304 | 317 |
|
305 | 318 | }
|
306 | 319 |
|
| 320 | + |
| 321 | + private static class ExceptionThrowingController { |
| 322 | + |
| 323 | + @GraphQlExceptionHandler |
| 324 | + GraphQLError handle(IllegalArgumentException ex) { |
| 325 | + throw new IllegalStateException("failure in exception handler"); |
| 326 | + } |
| 327 | + |
| 328 | + } |
| 329 | + |
307 | 330 | }
|
0 commit comments