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

dev.vality.woody.api.flow.error.WUndefinedResultException Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
package dev.vality.woody.api.flow.error;

public class WUndefinedResultException extends WRuntimeException {
    public WUndefinedResultException() {
        this(WErrorType.UNDEFINED_RESULT.getKey());
    }

    public WUndefinedResultException(String message) {
        super(message, createErrDef(message, null));
    }

    public WUndefinedResultException(String message, Throwable cause) {
        super(message, cause, createErrDef(message, cause));
    }

    public WUndefinedResultException(Throwable cause) {
        super(cause, createErrDef(WErrorType.UNDEFINED_RESULT.getKey(), null));
    }

    public WUndefinedResultException(String message, Throwable cause, boolean enableSuppression,
                                     boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace, createErrDef(message, cause));
    }

    public WUndefinedResultException(WErrorDefinition errorDefinition) {
        super(errorDefinition);
    }

    public WUndefinedResultException(String message, WErrorDefinition errorDefinition) {
        super(message, errorDefinition);
    }

    public WUndefinedResultException(String message, Throwable cause, WErrorDefinition errorDefinition) {
        super(message, cause, errorDefinition);
    }

    public WUndefinedResultException(Throwable cause, WErrorDefinition errorDefinition) {
        super(cause, errorDefinition);
    }

    public WUndefinedResultException(String message, Throwable cause, boolean enableSuppression,
                                     boolean writableStackTrace, WErrorDefinition errorDefinition) {
        super(message, cause, enableSuppression, writableStackTrace, errorDefinition);
    }

    private static WErrorDefinition createErrDef(String msg, Throwable cause) {
        WErrorDefinition errorDefinition = new WErrorDefinition(WErrorSource.INTERNAL);
        errorDefinition.setErrorType(WErrorType.UNDEFINED_RESULT);
        errorDefinition.setErrorSource(WErrorSource.INTERNAL);
        errorDefinition.setErrorReason(msg);
        if (cause != null) {
            errorDefinition.setErrorName(cause.getClass().getSimpleName());
            errorDefinition.setErrorMessage(cause.getMessage());
        } else {
            errorDefinition.setErrorName(WUndefinedResultException.class.getSimpleName());
            errorDefinition.setErrorMessage(msg);
        }
        return errorDefinition;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy