Commit 37f2cc2a authored by gongzuquan's avatar gongzuquan

异常信息优化

parent eac429ae
......@@ -13,8 +13,7 @@ public class YzgError {
private static YzgErrorData error = new YzgErrorData("999.");
private static void init() {
error.add("000", "%s");
error.add("000","%s");
error.add("001", "该页面未绑定表");
error.add("002", "类%s未发现表结构");
error.add("003", "类%s未发现SQL语句%s");
......@@ -26,18 +25,18 @@ public class YzgError {
error.add("009","文件类型不为图片、音频、视频");
error.add("010","文件%s已存在文件,不能创建目录");
error.add("011","创建文件夹失败");
error.add("012","文件删除失败");
error.add("012","文件[%s]删除失败");
error.add("013","变量名%s不支持");
error.add("014","正则表达式错误");
error.add("015","length params is error, must be greater than 0, this params is [%s]");
error.add("016","random code, essential data is empty.");
error.add("015","长度参数为错误,必须大于0,此参数为 [%s]");
error.add("016","随机码,基本数据为空。");
error.add("017","生成时间搓 MD5 ID 时,时间不能为空");
error.add("018","压缩时文件夹对象不能为空。");
error.add("019","[%s]不是一个文件夹,或者不存在。");
error.add("020","删除文件失败");
error.add("020","删除文件[%s]失败");
error.add("021","文件%s不存在");
error.add("022","没有抛出异常");
error.add("023","监视错误");
error.add("023","上下文获取失败");
error.add("024","导出时请传入配置信息");
error.add("025","不能处理非本条件的字段");
error.add("026","代码片段%s:%s:%s为单数");
......@@ -59,12 +58,47 @@ public class YzgError {
error.add("042","videoBitRateZip请在0~1之间");
error.add("043","你需要格式化的字符串格式为空");
error.add("044","不能获取文件Mime类型%s");
error.add("045","下载失败");
error.add("045","下载失败[%s]");
error.add("046","创建对象%s出错");
error.add("047","不能识别模板");
error.add("047","不能识别模板[%s]");
error.add("048","获取视频所缩类图失败:%s");
error.add("049","没有找到%s的数据");
error.add("050","地区编码不合法,长度不为9");
error.add("051","地区编码不合法,长度大于9");
error.add("052","获取百度接口日期失败");
error.add("053","获取百度日期正则表达式失败");
error.add("054","获取百度日期返回错误状态:%s");
error.add("055","获取百度日期数据格式已修改");
error.add("056","解密失败:%s");
error.add("057","请配置yzg.upload.server");
error.add("058","请配置yzg.upload.display");
error.add("059","Cookies缺少[%s]");
error.add("060","名称不能为空");
error.add("061","请先登录");
error.add("062","请上传文件");
error.add("063","文件[%s]保存失败");
error.add("064","文件[%s]不存在");
error.add("065","文件[%s]是目录");
error.add("066","请传入需要移动的文件");
error.add("067","移动来源路径不能为空");
error.add("068","移动目标路径不能为空");
error.add("069","不能用文件 %s 覆盖文件夹 %s");
error.add("070","移动文件 %s 到 %s 失败,原因:%s");
error.add("071","来源文件不存在");
error.add("072","来源文件不为视频");
error.add("073","获取视频缩略图失败");
error.add("074","请传入%s文件");
error.add("075","文件夹不能包含两个.");
error.add("076","文件夹不能包含\\u");
error.add("077","队列 %s 不存在");
error.add("078","交换器 %s 不存在");
error.add("079","算法错误");
error.add("080","当前队列没有消息");
error.add("081","消息队列%s消息%s已经执行");
error.add("082","请传入queue和messageId");
error.add("083","%s");
error.add("084","%s");
error.add("085","%s %s");
}
private static void initTemp() {
......@@ -87,7 +121,7 @@ public class YzgError {
* @param code
* @param args
*/
public static CodeException throwException(Exception ex, String code, Object... args) {
public static CodeException throwException(Throwable ex, String code, Object... args) {
throw error.getCodeException(ex, code, args);
}
......@@ -107,7 +141,7 @@ public class YzgError {
* @param code
* @param args
*/
public static CodeException getException(Exception ex, String code, Object... args) {
public static CodeException getException(Throwable ex, String code, Object... args) {
return error.getCodeException(ex, code, args);
}
......@@ -127,7 +161,7 @@ public class YzgError {
* @param code
* @param args
*/
public static RuntimeCodeException throwRuntimeException(Exception ex, String code, Object... args) {
public static RuntimeCodeException throwRuntimeException(Throwable ex, String code, Object... args) {
throw error.getRuntimeException(ex, code, args);
}
......@@ -147,7 +181,7 @@ public class YzgError {
* @param code
* @param args
*/
public static RuntimeCodeException getRuntimeException(Exception ex, String code, Object... args) {
public static RuntimeCodeException getRuntimeException(Throwable ex, String code, Object... args) {
return error.getRuntimeException(ex, code, args);
}
......
......@@ -220,11 +220,11 @@ public class FileHelper {
// 删除文件
if (file.exists()) {
if (!file.delete()) {
throw YzgError.getRuntimeException("012");
throw YzgError.getRuntimeException("012",file.getName());
}
}
if (file.exists()) {
throw YzgError.getRuntimeException("012");
throw YzgError.getRuntimeException("012",file.getName());
}
writeFileAppend(file, content, encoding);
} catch (RuntimeException e) {
......
......@@ -51,7 +51,7 @@ public class RunHelper {
}
}
if (ex != null) {
throw YzgError.getRuntimeException(ex, "049", tag, ex.getMessage());
throw YzgError.getRuntimeException(ex, "085", tag, ex.getMessage());
}
}
}
......@@ -29,7 +29,7 @@ public class RunnableList extends AbstractThreadList<Runnable> {
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
throw YzgError.getRuntimeException("050", ex.getMessage());
throw YzgError.getRuntimeException("084", ex.getMessage());
}
}
}
......@@ -158,7 +158,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
} else {
throw YzgError.getRuntimeException(ex, "051", ex.getMessage());
throw YzgError.getRuntimeException(ex, "083", ex.getMessage());
}
}
......
......@@ -429,7 +429,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
File file = new File(this.getFileName());
if (file.exists()) {
if (!file.delete()) {
throw YzgError.getRuntimeException("012");
throw YzgError.getRuntimeException("012",file.getName());
}
}
return this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment