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
c2c16b9b
Commit
c2c16b9b
authored
Mar 26, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错误处理
parent
07a5ecd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
7 deletions
+38
-7
ResponseResult.java
...src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
+38
-7
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
View file @
c2c16b9b
...
...
@@ -162,14 +162,45 @@ public class ResponseResult<T> extends BaseVo {
/**
* 处理错误
*
* @param code
* @param message
* @param target
* @param <T>
* @return
* @param target 错误源对象
* @return 处理的错误
*/
public
static
final
ResponseResult
error
(
Object
target
)
{
return
error
(
ResultConstants
.
UNKNOW_ERROR
,
"未知异常"
,
target
);
}
/**
* 处理错误
*
* @param code 错误码
* @param message 错误消息
* @return 处理的错误
*/
public
static
final
ResponseResult
error
(
String
code
,
String
message
)
{
return
error
(
code
,
message
,
null
);
}
/**
* 处理错误
*
* @param message 错误消息
* @param target 错误标记
* @return 处理的错误
*/
public
static
final
ResponseResult
error
(
String
message
,
Object
target
)
{
return
error
(
ResultConstants
.
UNKNOW_ERROR
,
message
,
null
);
}
/**
* 处理错误
*
* @param code 错误码
* @param message 错误消息
* @param target 错误标记
* @return 处理的错误
*/
public
static
final
<
T
extends
Object
>
ResponseResult
<
T
>
error
(
String
code
,
String
message
,
T
data
,
Object
target
)
{
ResponseResult
<
T
>
ret
=
new
ResponseResult
<>(
code
,
message
,
data
,
target
);
public
static
final
ResponseResult
error
(
String
code
,
String
message
,
Object
target
)
{
ResponseResult
ret
=
new
ResponseResult
(
code
,
message
,
null
,
target
);
return
ret
;
}
}
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