diff --git a/src/main/java/eu/hbp/mip/configuration/PortalErrorAttributes.java b/src/main/java/eu/hbp/mip/configuration/PortalErrorAttributes.java index 5c7f180bea5d01dc4d7d756ac73535401148569b..da3096d941a4f9046aa3a5e5b3d84705bf11b0b4 100644 --- a/src/main/java/eu/hbp/mip/configuration/PortalErrorAttributes.java +++ b/src/main/java/eu/hbp/mip/configuration/PortalErrorAttributes.java @@ -19,13 +19,17 @@ public class PortalErrorAttributes extends DefaultErrorAttributes { Throwable throwable = getError(requestAttributes); LOGGER.warn("Reporting server error", throwable); - Throwable cause = throwable.getCause(); - if (cause != null) { - Map<String, Object> causeErrorAttributes = new HashMap<>(); - causeErrorAttributes.put("exception", cause.getClass().getName()); - causeErrorAttributes.put("message", cause.getMessage()); - errorAttributes.put("cause", causeErrorAttributes); + if (throwable != null) { + + Throwable cause = throwable.getCause(); + if (cause != null) { + Map<String, Object> causeErrorAttributes = new HashMap<>(); + causeErrorAttributes.put("exception", cause.getClass().getName()); + causeErrorAttributes.put("message", cause.getMessage()); + errorAttributes.put("cause", causeErrorAttributes); + } } + return errorAttributes; } }