From 53ed0b17450bc503335c263148523e2a598cf9fe Mon Sep 17 00:00:00 2001 From: Sonia Zorba <sonia.zorba@inaf.it> Date: Mon, 15 Feb 2021 13:59:44 +0100 Subject: [PATCH] Implemented import of portal files to DataNodes --- .../exception/InternalFaultException.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/it/inaf/oats/vospace/exception/InternalFaultException.java b/src/main/java/it/inaf/oats/vospace/exception/InternalFaultException.java index 2429c07..635bf57 100644 --- a/src/main/java/it/inaf/oats/vospace/exception/InternalFaultException.java +++ b/src/main/java/it/inaf/oats/vospace/exception/InternalFaultException.java @@ -1,19 +1,25 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ package it.inaf.oats.vospace.exception; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; - @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) // Status code 500 -public class InternalFaultException extends VoSpaceException { +public class InternalFaultException extends VoSpaceException { + + private static final Logger LOG = LoggerFactory.getLogger(InternalFaultException.class); public InternalFaultException(String msg) { super("InternalFaultException: " + msg); } - + + public InternalFaultException(Throwable cause) { + super("InternalFaultException: " + getMessage(cause)); + } + + private static String getMessage(Throwable cause) { + LOG.error("Exception caught", cause); + return cause.getMessage() != null ? cause.getMessage() : cause.getClass().getCanonicalName(); + } } -- GitLab