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

org.squirrelframework.foundation.exception.SquirrelRuntimeException Maven / Gradle / Ivy

Go to download

foundation module of squirrel framework which provided event driven infrastructure and a finite state machine implementation.

There is a newer version: 0.3.10
Show newest version
package org.squirrelframework.foundation.exception;

public class SquirrelRuntimeException extends RuntimeException {
    
    private static final long serialVersionUID = -4324278329515258777L;
    
    private int errorCodeId;
    
    private Throwable targetException;
    
    private String errorMessage;
    
//    private String localizedErrorMessage;
    
    public SquirrelRuntimeException(ErrorCodes errorCode) {
        this.errorCodeId = errorCode.getCode();
        this.errorMessage = String.format("%08d : %s.", getErrorCodeId(), errorCode.getDescription());
    }
    
    public SquirrelRuntimeException(ErrorCodes errorCode, Object...parameters) {
        this.errorCodeId = errorCode.getCode();
        this.errorMessage = String.format("%08d : %s.", getErrorCodeId(), 
                String.format(errorCode.getDescription(), parameters));
    }
    
    public SquirrelRuntimeException(Throwable targetException, ErrorCodes errorCode, Object...parameters) {
        this(errorCode, parameters);
        this.targetException = targetException;
    }
    
    public int getErrorCodeId() {
        return errorCodeId;
    }
    
    public Throwable getTargetException() {
        return targetException;
    }
    
    @Override
    public String getMessage() {
        return errorMessage;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy