Skip to content

Commit

Permalink
debug unwrap ejb ex
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Aug 1, 2024
1 parent ac09888 commit b68a236
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.stream.Collectors;

import jakarta.ejb.EJB;
import jakarta.ejb.EJBException;
import jakarta.enterprise.context.SessionScoped;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.UIComponent;
Expand Down Expand Up @@ -202,7 +203,18 @@ public String createNewAccount() {
tokenData.setOauthProviderId(newUser.getServiceId());
oauth2Tokens.store(tokenData);
}
} catch (ConstraintViolationException cvex) {
} catch (EJBException ejbex) {
Exception e = ejbex.getCausedByException();
if (e instanceof ConstraintViolationException cvex) {
Set<ConstraintViolation<?>> errors = cvex.getConstraintViolations();
String errorStr = errors.stream()
.map(er -> er.getMessage() + er.getPropertyPath())
.collect(Collectors.joining(", "));
logger.info(errorStr);
throw (ejbex);
}
}
catch (ConstraintViolationException cvex) {
Set<ConstraintViolation<?>> errors = cvex.getConstraintViolations();
String errorStr = errors.stream()
.map(er -> er.getMessage() + er.getPropertyPath())
Expand Down

0 comments on commit b68a236

Please sign in to comment.