All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.tcurrie.rest.factory.v1.ExceptionWrapper Maven / Gradle / Ivy

There is a newer version: 0.2.70
Show newest version
package com.github.tcurrie.rest.factory.v1;

import com.github.tcurrie.rest.factory.Strings;

public class ExceptionWrapper {
    private Class exceptionType;
    private String message;
    private String stackTrace;

    public static ExceptionWrapper createException(final Throwable exception) {
        final String trace = Strings.getStackTrace(exception);
        return new ExceptionWrapper(exception.getClass(), exception.getMessage(), trace);
    }

    private ExceptionWrapper(final Class exceptionType, final String message, final String stackTrace) {
        this.exceptionType = exceptionType;
        this.message = message;
        this.stackTrace = stackTrace;
    }

    @SuppressWarnings("unused")
    private ExceptionWrapper() {}

    public String getStackTrace() {
        return stackTrace;
    }

    public Class getExceptionType() {
        return exceptionType;
    }

    public String getMessage() {
        return message;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy