com.taobao.hsf.exception.HSFException Maven / Gradle / Ivy
/**
* High-Speed Service Framework (HSF)
*
* www.taobao.com
* (C) 淘宝(中国) 2003-2014
*/
package com.taobao.hsf.exception;
/**
* HSF异常类
*
* @author zhidao
*/
public class HSFException extends Exception {
private static final long serialVersionUID = -4112893957263497578L;
private static final String lineSeparator = System.getProperty("line.separator");
private final String exceptionCode;
private final String desc;
public HSFException(String exceptionCode) {
this(exceptionCode, "");
}
public HSFException(String exceptionCode, String desc) {
super(exceptionCode);
this.exceptionCode = exceptionCode;
this.desc = desc;
}
public HSFException(String exceptionCode, String desc, Throwable t) {
super(desc, t);
this.exceptionCode = exceptionCode;
this.desc = desc;
}
public HSFException(String exceptionCode, Throwable t) {
this(exceptionCode, null, t);
}
@Override
public String toString() {
if (desc == null) {
return exceptionCode;
}
StringBuilder sb = new StringBuilder(exceptionCode);
sb.append(lineSeparator);
sb.append("Desc info:").append(desc);
return sb.toString();
}
}