Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
e9f83766
Commit
e9f83766
authored
Nov 07, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
升级新版本
parent
27382b53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
140 deletions
+112
-140
YzgError.java
...til-base/src/main/java/com/yanzuoguang/util/YzgError.java
+112
-140
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/YzgError.java
View file @
e9f83766
...
...
@@ -3,6 +3,8 @@ package com.yanzuoguang.util;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.RuntimeCodeException
;
import
java.util.function.Consumer
;
/**
* 系统错误编码
*
...
...
@@ -10,184 +12,154 @@ import com.yanzuoguang.util.exception.RuntimeCodeException;
*/
public
class
YzgError
{
private
static
final
YzgErrorData
error
=
new
YzgErrorData
(
"999."
);
private
static
final
YzgErrorData
ERROR
=
new
YzgErrorData
(
"999."
);
private
static
void
init
()
{
error
.
add
(
"000"
,
"%s"
);
error
.
add
(
"001"
,
"该页面未绑定表"
);
error
.
add
(
"002"
,
"类%s未发现表结构"
);
error
.
add
(
"003"
,
"类%s未发现SQL语句%s"
);
error
.
add
(
"004"
,
"泛型继承检测错误"
);
error
.
add
(
"005"
,
"视频文件不存在"
);
error
.
add
(
"006"
,
"对象%s不能复制"
);
error
.
add
(
"007"
,
"整形转换成字节的PCD码必须小于100"
);
error
.
add
(
"008"
,
"不能识别文件类型%s"
);
error
.
add
(
"009"
,
"文件类型不为图片、音频、视频"
);
error
.
add
(
"010"
,
"文件%s已存在文件,不能创建目录"
);
error
.
add
(
"011"
,
"创建文件夹失败"
);
error
.
add
(
"012"
,
"文件[%s]删除失败"
);
error
.
add
(
"013"
,
"变量名%s不支持"
);
error
.
add
(
"014"
,
"正则表达式错误"
);
error
.
add
(
"015"
,
"长度参数为错误,必须大于0,此参数为 [%s]"
);
error
.
add
(
"016"
,
"随机码,基本数据为空。"
);
error
.
add
(
"017"
,
"生成时间搓 MD5 ID 时,时间不能为空"
);
error
.
add
(
"018"
,
"压缩时文件夹对象不能为空。"
);
error
.
add
(
"019"
,
"[%s]不是一个文件夹,或者不存在。"
);
error
.
add
(
"020"
,
"删除文件[%s]失败"
);
error
.
add
(
"021"
,
"文件%s不存在"
);
error
.
add
(
"022"
,
"没有抛出异常"
);
error
.
add
(
"023"
,
"上下文获取失败"
);
error
.
add
(
"024"
,
"导出时请传入配置信息"
);
error
.
add
(
"025"
,
"不能处理非本条件的字段"
);
error
.
add
(
"026"
,
"代码片段%s:%s:%s为单数"
);
error
.
add
(
"027"
,
"SqlCondItem不支持输入参数,必须带代码片段"
);
error
.
add
(
"028"
,
"需要格式化的字符串不支持"
);
error
.
add
(
"029"
,
"表%s主键值为空时不能更新"
);
error
.
add
(
"030"
,
"修改失败,请确认是否被其他人修改,版本号传入是否正确"
);
error
.
add
(
"031"
,
"统计类型[%s]不支持"
);
error
.
add
(
"032"
,
"SQL语句%s不存在纬度%s"
);
error
.
add
(
"033"
,
"表中未包含MD5字段"
);
error
.
add
(
"034"
,
"Excel已初始化"
);
error
.
add
(
"035"
,
"保存失败"
);
error
.
add
(
"036"
,
"保存路径%s失败"
);
error
.
add
(
"037"
,
"%s失败,该数据可能已被修改"
);
error
.
add
(
"038"
,
"size请在0~1之间"
);
error
.
add
(
"039"
,
"视频转码压缩时文件不存在:%s"
);
error
.
add
(
"040"
,
"audioBitRateZip请在0~1之间"
);
error
.
add
(
"041"
,
"videoSizeZip请在0~1之间"
);
error
.
add
(
"042"
,
"videoBitRateZip请在0~1之间"
);
error
.
add
(
"043"
,
"你需要格式化的字符串格式为空"
);
error
.
add
(
"044"
,
"不能获取文件Mime类型%s"
);
error
.
add
(
"045"
,
"下载失败[%s]"
);
error
.
add
(
"046"
,
"创建对象%s出错"
);
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]保存失败,保存路径为:%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
()
{
}
/**
* 抛出异常
*
* @param code
* @param args
*/
public
static
CodeException
throwException
(
String
code
,
Object
...
args
)
{
throw
error
.
getCodeException
(
null
,
code
,
args
);
ERROR
.
add
(
"000"
,
"%s"
);
ERROR
.
add
(
"001"
,
"该页面未绑定表"
);
ERROR
.
add
(
"002"
,
"类%s未发现表结构"
);
ERROR
.
add
(
"003"
,
"类%s未发现SQL语句%s"
);
ERROR
.
add
(
"004"
,
"泛型继承检测错误"
);
ERROR
.
add
(
"005"
,
"视频文件不存在"
);
ERROR
.
add
(
"006"
,
"对象%s不能复制"
);
ERROR
.
add
(
"007"
,
"整形转换成字节的PCD码必须小于100"
);
ERROR
.
add
(
"008"
,
"不能识别文件类型%s"
);
ERROR
.
add
(
"009"
,
"文件类型不为图片、音频、视频"
);
ERROR
.
add
(
"010"
,
"文件%s已存在文件,不能创建目录"
);
ERROR
.
add
(
"011"
,
"创建文件夹失败"
);
ERROR
.
add
(
"012"
,
"文件[%s]删除失败"
);
ERROR
.
add
(
"013"
,
"变量名%s不支持"
);
ERROR
.
add
(
"014"
,
"正则表达式错误"
);
ERROR
.
add
(
"015"
,
"长度参数为错误,必须大于0,此参数为 [%s]"
);
ERROR
.
add
(
"016"
,
"随机码,基本数据为空。"
);
ERROR
.
add
(
"017"
,
"生成时间搓 MD5 ID 时,时间不能为空"
);
ERROR
.
add
(
"018"
,
"压缩时文件夹对象不能为空。"
);
ERROR
.
add
(
"019"
,
"[%s]不是一个文件夹,或者不存在。"
);
ERROR
.
add
(
"020"
,
"删除文件[%s]失败"
);
ERROR
.
add
(
"021"
,
"文件%s不存在"
);
ERROR
.
add
(
"022"
,
"没有抛出异常"
);
ERROR
.
add
(
"023"
,
"上下文获取失败"
);
ERROR
.
add
(
"024"
,
"导出时请传入配置信息"
);
ERROR
.
add
(
"025"
,
"不能处理非本条件的字段"
);
ERROR
.
add
(
"026"
,
"代码片段%s:%s:%s为单数"
);
ERROR
.
add
(
"027"
,
"SqlCondItem不支持输入参数,必须带代码片段"
);
ERROR
.
add
(
"028"
,
"需要格式化的字符串不支持"
);
ERROR
.
add
(
"029"
,
"表%s主键值为空时不能更新"
);
ERROR
.
add
(
"030"
,
"修改失败,请确认是否被其他人修改,版本号传入是否正确"
);
ERROR
.
add
(
"031"
,
"统计类型[%s]不支持"
);
ERROR
.
add
(
"032"
,
"SQL语句%s不存在纬度%s"
);
ERROR
.
add
(
"033"
,
"表中未包含MD5字段"
);
ERROR
.
add
(
"034"
,
"Excel已初始化"
);
ERROR
.
add
(
"035"
,
"保存失败"
);
ERROR
.
add
(
"036"
,
"保存路径%s失败"
);
ERROR
.
add
(
"037"
,
"%s失败,该数据可能已被修改"
);
ERROR
.
add
(
"038"
,
"size请在0~1之间"
);
ERROR
.
add
(
"039"
,
"视频转码压缩时文件不存在:%s"
);
ERROR
.
add
(
"040"
,
"audioBitRateZip请在0~1之间"
);
ERROR
.
add
(
"041"
,
"videoSizeZip请在0~1之间"
);
ERROR
.
add
(
"042"
,
"videoBitRateZip请在0~1之间"
);
ERROR
.
add
(
"043"
,
"你需要格式化的字符串格式为空"
);
ERROR
.
add
(
"044"
,
"不能获取文件Mime类型%s"
);
ERROR
.
add
(
"045"
,
"下载失败[%s]"
);
ERROR
.
add
(
"046"
,
"创建对象%s出错"
);
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]保存失败,保存路径为:%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"
);
}
/**
*
抛出异常
*
注册错误消息
*
* @param code
* @param args
* @param callback 回调处理错误消息
*/
public
static
CodeException
throwException
(
Throwable
ex
,
String
code
,
Object
...
args
)
{
throw
error
.
getCodeException
(
ex
,
code
,
args
);
public
static
void
register
(
Consumer
<
YzgErrorData
>
callback
)
{
if
(
callback
==
null
)
{
return
;
}
callback
.
accept
(
ERROR
);
}
/**
* 抛出异常
*
* @param code
* @param args
* @param code 错误码
* @param args 错误参数
* @return 异常信息
*/
public
static
CodeException
getException
(
String
code
,
Object
...
args
)
{
return
error
.
getCodeException
(
null
,
code
,
args
);
return
ERROR
.
getCodeException
(
null
,
code
,
args
);
}
/**
* 抛出异常
*
* @param code
* @param args
* @param code 错误码
* @param args 错误参数
* @return 异常信息
*/
public
static
CodeException
getException
(
Throwable
ex
,
String
code
,
Object
...
args
)
{
return
error
.
getCodeException
(
ex
,
code
,
args
);
}
/**
* 抛出异常
*
* @param code
* @param args
*/
public
static
RuntimeCodeException
throwRuntimeException
(
String
code
,
Object
...
args
)
{
throw
error
.
getRuntimeException
(
null
,
code
,
args
);
}
/**
* 抛出异常
*
* @param code
* @param args
*/
public
static
RuntimeCodeException
throwRuntimeException
(
Throwable
ex
,
String
code
,
Object
...
args
)
{
throw
error
.
getRuntimeException
(
ex
,
code
,
args
);
return
ERROR
.
getCodeException
(
ex
,
code
,
args
);
}
/**
* 抛出异常
*
* @param code
* @param args
* @param code 错误码
* @param args 错误参数
* @return 异常信息
*/
public
static
RuntimeCodeException
getRuntimeException
(
String
code
,
Object
...
args
)
{
return
error
.
getRuntimeException
(
null
,
code
,
args
);
return
ERROR
.
getRuntimeException
(
null
,
code
,
args
);
}
/**
* 抛出异常
*
* @param code
* @param args
* @param code 错误码
* @param args 错误参数
* @return 异常信息
*/
public
static
RuntimeCodeException
getRuntimeException
(
Throwable
ex
,
String
code
,
Object
...
args
)
{
return
error
.
getRuntimeException
(
ex
,
code
,
args
);
return
ERROR
.
getRuntimeException
(
ex
,
code
,
args
);
}
static
{
init
();
initTemp
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment