
goja.core.exceptions.UnexpectedException Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013-2014 sagyf Yang. The Four Group.
*/
package goja.core.exceptions;
/**
*
* .
*
*
* @author sagyf yang
* @version 1.0 2014-04-04 10:19
* @since JDK 1.6
*/
public class UnexpectedException extends GojaException {
private static final long serialVersionUID = 1566068631802877144L;
public UnexpectedException(String message) {
super(message);
}
public UnexpectedException(Throwable exception) {
super("Unexpected Error", exception);
}
public UnexpectedException(String message, Throwable cause) {
super(message, cause);
}
@Override
public String getErrorTitle() {
if (getCause() == null) {
return "Unexpected error";
}
return String.format("Oops: %s", getCause().getClass().getSimpleName());
}
@Override
public String getErrorDescription() {
if (getCause() != null && getCause().getClass() != null)
return String.format("An unexpected error occured caused by exception %s:
%s", getCause().getClass().getSimpleName(), getCause().getMessage());
else return String.format("Unexpected error : %s", getMessage());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy