Skip to content

Commit

Permalink
SpringdocRouteBuilder.onError is overriding last route defined. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
bnasslahsen committed Dec 2, 2023
1 parent b6f9c1d commit 296af61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,10 @@ public SpringdocRouteBuilder after(BiFunction<ServerRequest, ServerResponse, Ser
*
* @param predicate the predicate
* @param responseProvider the response provider
* @param operationsConsumer the operations consumer
* @return the springdoc route builder
*/
public SpringdocRouteBuilder onError(Predicate<? super Throwable> predicate, BiFunction<? super Throwable, ServerRequest, Mono<ServerResponse>> responseProvider, Consumer<Builder> operationsConsumer) {
Builder builder = getOperationBuilder(operationsConsumer);
this.delegate.onError(predicate, responseProvider).withAttribute(OPERATION_ATTRIBUTE, builder);
public SpringdocRouteBuilder onError(Predicate<? super Throwable> predicate, BiFunction<? super Throwable, ServerRequest, Mono<ServerResponse>> responseProvider) {
this.delegate.onError(predicate, responseProvider);
return this;
}

Expand All @@ -667,12 +665,10 @@ public SpringdocRouteBuilder onError(Predicate<? super Throwable> predicate, BiF
* @param <T> the type parameter
* @param exceptionType the exception type
* @param responseProvider the response provider
* @param operationsConsumer the operations consumer
* @return the springdoc route builder
*/
public <T extends Throwable> SpringdocRouteBuilder onError(Class<T> exceptionType, BiFunction<? super T, ServerRequest, Mono<ServerResponse>> responseProvider, Consumer<Builder> operationsConsumer) {
Builder builder = getOperationBuilder(operationsConsumer);
this.delegate.onError(exceptionType, responseProvider).withAttribute(OPERATION_ATTRIBUTE, builder);
public <T extends Throwable> SpringdocRouteBuilder onError(Class<T> exceptionType, BiFunction<? super T, ServerRequest, Mono<ServerResponse>> responseProvider) {
this.delegate.onError(exceptionType, responseProvider);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,10 @@ public SpringdocRouteBuilder after(BiFunction<ServerRequest, ServerResponse, Ser
*
* @param predicate the predicate
* @param responseProvider the response provider
* @param operationsConsumer the operations consumer
* @return the springdoc route builder
*/
public SpringdocRouteBuilder onError(Predicate<Throwable> predicate, BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider, Consumer<Builder> operationsConsumer) {
Builder builder = getOperationBuilder(operationsConsumer);
this.delegate.onError(predicate, responseProvider).withAttribute(OPERATION_ATTRIBUTE, builder);
public SpringdocRouteBuilder onError(Predicate<Throwable> predicate, BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider) {
this.delegate.onError(predicate, responseProvider);
return this;
}

Expand All @@ -667,12 +665,10 @@ public SpringdocRouteBuilder onError(Predicate<Throwable> predicate, BiFunction<
* @param <T> the type parameter
* @param exceptionType the exception type
* @param responseProvider the response provider
* @param operationsConsumer the operations consumer
* @return the springdoc route builder
*/
public <T extends Throwable> SpringdocRouteBuilder onError(Class<T> exceptionType, BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider, Consumer<Builder> operationsConsumer) {
Builder builder = getOperationBuilder(operationsConsumer);
this.delegate.onError(exceptionType, responseProvider).withAttribute(OPERATION_ATTRIBUTE, builder);
public <T extends Throwable> SpringdocRouteBuilder onError(Class<T> exceptionType, BiFunction<Throwable, ServerRequest, ServerResponse> responseProvider) {
this.delegate.onError(exceptionType, responseProvider);
return this;
}

Expand Down

0 comments on commit 296af61

Please sign in to comment.