Skip to content

Commit

Permalink
Merge pull request #407 from deutschebank/spring-bot-master-db
Browse files Browse the repository at this point in the history
Compatibility With Spring-boot 3x
  • Loading branch information
vaibhav-db committed Aug 18, 2023
2 parents e732e4d + 2347e57 commit 6704873
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public UserListResponseHandler userListResponseHandler() {

@Bean
@ConditionalOnMissingBean
public ChatWorkflowErrorHandler chatWorkflowErrorHandler(ResponseHandlers rh) {
public ErrorHandler chatWorkflowErrorHandler(ResponseHandlers rh) {
return new ChatWorkflowErrorHandler(rh, "default-error");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.finos.springbot.workflow.actions;

import org.finos.springbot.workflow.content.Addressable;
import org.finos.springbot.workflow.content.User;

public class ErrorAction implements Action {

private final Addressable a;
private final Object data;

public ErrorAction(Addressable a, Object ej) {
super();
this.a = a;
this.data = ej;
}

@Override
public Addressable getAddressable() {
return a;
}


@Override
public Object getData() {
return data;
}

@Override
public User getUser() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public CompletableFuture<ResponseEntity<Object>> incoming(

if (exception instanceof CompletionException) {
if (exception.getCause() instanceof AuthenticationException) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
return ResponseEntity.status(HttpStatus.UNAUTHORIZED.value()).build();
} else {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
return ResponseEntity.internalServerError().build();
}
} else {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
return ResponseEntity.internalServerError().build();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
import org.finos.springbot.teams.templating.adaptivecard.AdaptiveCardPassthrough;
import org.finos.springbot.teams.templating.adaptivecard.AdaptiveCardTemplateProvider;
import org.finos.springbot.teams.templating.thymeleaf.ThymeleafTemplateProvider;
import org.finos.springbot.workflow.actions.Action;
import org.finos.springbot.workflow.actions.ErrorAction;
import org.finos.springbot.workflow.annotations.WorkMode;
import org.finos.springbot.workflow.response.AttachmentResponse;
import org.finos.springbot.workflow.response.ErrorResponse;
import org.finos.springbot.workflow.response.MessageResponse;
import org.finos.springbot.workflow.response.Response;
import org.finos.springbot.workflow.response.WorkResponse;
Expand Down Expand Up @@ -192,8 +195,13 @@ private BiFunction<? super ResourceResponse, Throwable, ResourceResponse> handle
LOG.error("message:\n"+out);
}

if(!(t instanceof ErrorResponse)) {
Action.CURRENT_ACTION.set(new ErrorAction(address, data));
}

initErrorHandler();
eh.handleError(e);
eh.handleError(e);
Action.CURRENT_ACTION.set(Action.NULL_ACTION);
} else if(rr != null) {
performStorage(address, data, teamsState);
}
Expand Down

0 comments on commit 6704873

Please sign in to comment.