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
37f2cc2a
Commit
37f2cc2a
authored
Aug 12, 2021
by
gongzuquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常信息优化
parent
eac429ae
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
21 deletions
+55
-21
YzgError.java
...til-base/src/main/java/com/yanzuoguang/util/YzgError.java
+49
-15
FileHelper.java
...src/main/java/com/yanzuoguang/util/helper/FileHelper.java
+2
-2
RunHelper.java
.../src/main/java/com/yanzuoguang/util/helper/RunHelper.java
+1
-1
RunnableList.java
...c/main/java/com/yanzuoguang/util/thread/RunnableList.java
+1
-1
RunnableListAutoItem.java
...ava/com/yanzuoguang/util/thread/RunnableListAutoItem.java
+1
-1
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+1
-1
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/YzgError.java
View file @
37f2cc2a
...
...
@@ -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
);
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/FileHelper.java
View file @
37f2cc2a
...
...
@@ -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
)
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/RunHelper.java
View file @
37f2cc2a
...
...
@@ -51,7 +51,7 @@ public class RunHelper {
}
}
if
(
ex
!=
null
)
{
throw
YzgError
.
getRuntimeException
(
ex
,
"0
49
"
,
tag
,
ex
.
getMessage
());
throw
YzgError
.
getRuntimeException
(
ex
,
"0
85
"
,
tag
,
ex
.
getMessage
());
}
}
}
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableList.java
View file @
37f2cc2a
...
...
@@ -29,7 +29,7 @@ public class RunnableList extends AbstractThreadList<Runnable> {
}
catch
(
RuntimeException
ex
)
{
throw
ex
;
}
catch
(
Exception
ex
)
{
throw
YzgError
.
getRuntimeException
(
"0
50
"
,
ex
.
getMessage
());
throw
YzgError
.
getRuntimeException
(
"0
84
"
,
ex
.
getMessage
());
}
}
}
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableListAutoItem.java
View file @
37f2cc2a
...
...
@@ -158,7 +158,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
if
(
ex
instanceof
RuntimeException
)
{
throw
(
RuntimeException
)
ex
;
}
else
{
throw
YzgError
.
getRuntimeException
(
ex
,
"0
51
"
,
ex
.
getMessage
());
throw
YzgError
.
getRuntimeException
(
ex
,
"0
83
"
,
ex
.
getMessage
());
}
}
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
37f2cc2a
...
...
@@ -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
;
...
...
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