Search in sources :

Example 1 with TechnicalError

use of org.sklsft.commons.api.exception.TechnicalError in project skeleton-commons by skeleton-software-community.

the class ErrorReportHandler method convertErrorReport.

/**
 * instantiates the {@link ApplicationException} as described in the {@link ErrorReport} that a rest service can respond
 * @param errorReport
 */
public void convertErrorReport(ErrorReport errorReport) {
    ApplicationException exception;
    try {
        exception = (ApplicationException) Class.forName(errorReport.getExceptionClassName()).newInstance();
        exception.setMessage(errorReport.getMessage());
        exception.setDetails(errorReport.getDetails());
    } catch (Exception e) {
        exception = new TechnicalError(ApplicationException.ERROR_UNKNOWN, e);
    }
    throw exception;
}
Also used : ApplicationException(org.sklsft.commons.api.exception.ApplicationException) TechnicalError(org.sklsft.commons.api.exception.TechnicalError) ApplicationException(org.sklsft.commons.api.exception.ApplicationException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ApplicationException (org.sklsft.commons.api.exception.ApplicationException)1 TechnicalError (org.sklsft.commons.api.exception.TechnicalError)1