com.wichell.core.exception.BaseException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wichell-common Show documentation
Show all versions of wichell-common Show documentation
common project com.wichell.wichell jar
The newest version!
/**
*
*/
package com.wichell.core.exception;
import org.apache.commons.lang3.StringUtils;
import com.wichell.core.support.HttpCode;
import org.springframework.ui.ModelMap;
/**
*
* @author Wichell
* @version 2016年6月7日 下午8:43:02
*/
@SuppressWarnings("serial")
public abstract class BaseException extends RuntimeException {
public BaseException() {
}
public BaseException(Throwable ex) {
super(ex);
}
public BaseException(String message) {
super(message);
}
public BaseException(String message, Throwable ex) {
super(message, ex);
}
public void handler(ModelMap modelMap) {
modelMap.put("code", getHttpCode().value().toString());
if (StringUtils.isNotBlank(getMessage())) {
modelMap.put("msg", getMessage());
} else {
modelMap.put("msg", getHttpCode().msg());
}
modelMap.put("timestamp", System.currentTimeMillis());
}
protected abstract HttpCode getHttpCode();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy