![JAR search and dependency download from the Maven repository](/logo.png)
nyla.solutions.global.exception.fault.FaultException Maven / Gradle / Ivy
package nyla.solutions.global.exception.fault;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import nyla.solutions.global.util.Debugger;
import nyla.solutions.global.util.Presenter;
public class FaultException extends RuntimeException implements Fault
{
/**
* serialVersionUID = -8500125749384413080L
*/
private static final long serialVersionUID = -8500125749384413080L;
public static final String DEFAULT_ERROR_CATEGORY_NM = "DEFAULT";
public FaultException(String message, String notes, String programName, String functionName,
String errorCategory, String errorCode)
{
super(message);
this.notes = notes;
this.module = programName;
this.operation = functionName;
this.category = errorCategory;
this.code = errorCode;
}
public FaultException()
{
super();
}// -----------------------------------------------
public FaultException(String message, Throwable cause)
{
super(message, cause);
}// -----------------------------------------------
public FaultException(String message)
{
super(message);
this.notes = message;
}// -----------------------------------------------
public FaultException(Throwable cause)
{
super(cause);
}// -----------------------------------------------
public FaultException(String message, String functionName, String errorCategory,
String errorCode, String programName)
{
super(message);
this.operation = functionName;
this.category = errorCategory;
this.code = errorCode;
this.module = programName;
this.notes = message;
}// -----------------------------------------------
public FaultException(String message, Throwable cause, String functionName, String errorCategory,
String errorCode, String programName)
{
super(message, cause);
this.operation = functionName;
this.category = errorCategory;
this.code = errorCode;
this.module = programName;
}// -----------------------------------------------
public FaultException(Throwable cause, String functionName, String errorCategory,
String errorCode, String programName)
{
super(cause);
this.operation = functionName;
this.category = errorCategory;
this.code = errorCode;
this.module = programName;
}// -----------------------------------------------
/**
*
* @return the exception stack trace
*/
public String stackTrace()
{
return stackTrace(this);
}// -----------------------------------------------
/**
*
* @return the exception stack trace
*/
public static String stackTrace(Throwable e)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return sw.toString();
}// -----------------------------------------------
/* (non-Javadoc)
* @see solutions.gedi.exception.GediFault#getFunctionName()
*/
//@Override
public String getOperation()
{
return operation;
}// -----------------------------------------------
/**
* @param operation the functionName to set
*/
public void setOperation(String operation)
{
this.operation = operation;
}// -----------------------------------------------
/* (non-Javadoc)
* @see solutions.gedi.exception.GediFault#getErrorCategory()
*/
//@Override
public String getCategory()
{
return category;
}// -----------------------------------------------
/* (non-Javadoc)
* @see solutions.gedi.exception.GediFault#getErrorCode()
*/
//@Override
public String getCode()
{
return code;
}// -----------------------------------------------
/* (non-Javadoc)
* @see solutions.gedi.exception.GediFault#getProgramName()
*/
//@Override
public String getModule()
{
return module;
}
/**
* @param module the programName to set
*/
public void setModule(String module)
{
this.module = module;
}
/**
* @param errorCategory the errorCategory to set
*/
public void setCategory(String errorCategory)
{
this.category = errorCategory;
}
/**
* @param errorCode the errorCode to set
*/
public void setCode(String errorCode)
{
this.code = errorCode;
}
/**
* @return the notes
*/
public String getNotes()
{
return notes;
}
/**
* @param notes the notes to set
*/
public void setNotes(String notes)
{
this.notes = notes;
}
public void copy(Object object)
{
FaultException other = (FaultException)object;
this.notes = other.notes;
this.module = other.module;
this.operation = other.operation;
this.category = other.category;
this.code = other.code;
this.argument = other.argument;
this.setMessage(other.getMessage());
this.setStackTrace(other.getStackTrace());
}// --------------------------------------------------------
/**
* Format the exception message using the presenter getText method
* @param aID the key of the message
* @param aBindValues the values to plug into the message.
*/
protected void formatMessage(String aID, Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy