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
b04da154
Commit
b04da154
authored
Aug 10, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实例化关系
parent
1c3d04f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
25 deletions
+110
-25
HttpCodeException.java
...ava/com/yanzuoguang/util/exception/HttpCodeException.java
+110
-25
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/exception/HttpCodeException.java
View file @
b04da154
...
@@ -5,39 +5,56 @@ package com.yanzuoguang.util.exception;
...
@@ -5,39 +5,56 @@ package com.yanzuoguang.util.exception;
*
*
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
HttpCodeException
extends
RuntimeException
{
public
class
HttpCodeException
extends
RuntimeCodeException
{
private
static
final
long
serialVersionUID
=
-
4625832188480820883L
;
/**
* 错误码
*/
private
String
code
=
"99"
;
/**
/**
* 包含的数据
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param code the detail code (which is saved for later retrieval
* by the {@link #getCode()} method).
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
*/
private
Object
target
=
null
;
public
HttpCodeException
(
String
code
,
String
message
,
Throwable
cause
)
{
super
(
code
,
message
,
cause
);
}
/**
/**
* 获取错误码
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("02","该订单未到使用时间",order);
*
*
* @return 返回的结果
* @param message 错误消息
* @param target 错误数据源,如订单数据
*/
*/
public
String
getCode
(
)
{
public
HttpCodeException
(
String
message
,
Object
target
)
{
return
this
.
code
;
super
(
message
,
target
)
;
}
}
/**
/**
* 来源数据
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("02","该订单未到使用时间",order);
*
*
* @return
* @param message 错误消息
* @param target 错误数据源,如订单数据
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
*/
public
Object
getTarget
(
)
{
public
HttpCodeException
(
String
message
,
Object
target
,
Throwable
cause
)
{
return
target
;
super
(
message
,
target
,
cause
)
;
}
}
/**
/**
* 构造函数
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("01","该订单已过期",order);
...
@@ -45,11 +62,10 @@ public class HttpCodeException extends RuntimeException {
...
@@ -45,11 +62,10 @@ public class HttpCodeException extends RuntimeException {
*
*
* @param code 错误码
* @param code 错误码
* @param message 错误消息
* @param message 错误消息
* @param target 错误数据源,如订单数据
*/
*/
public
HttpCodeException
(
String
code
,
String
message
)
{
public
HttpCodeException
(
String
code
,
String
message
,
Object
target
)
{
super
(
message
);
super
(
code
,
message
,
target
);
this
.
code
=
code
;
this
.
target
=
null
;
}
}
/**
/**
...
@@ -66,8 +82,77 @@ public class HttpCodeException extends RuntimeException {
...
@@ -66,8 +82,77 @@ public class HttpCodeException extends RuntimeException {
* unknown.)
* unknown.)
*/
*/
public
HttpCodeException
(
String
code
,
String
message
,
Object
target
,
Throwable
cause
)
{
public
HttpCodeException
(
String
code
,
String
message
,
Object
target
,
Throwable
cause
)
{
super
(
code
,
message
,
target
,
cause
);
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public
HttpCodeException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
super
(
message
,
cause
);
this
.
code
=
code
;
}
this
.
target
=
target
;
/**
* Constructs a new runtime exception with {@code null} as its
* detail message. The cause is not initialized, and may subsequently be
* initialized by a call to {@link #initCause}.
*/
public
HttpCodeException
()
{
super
();
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param code the detail code (which is saved for later retrieval
* by the {@link #getCode()} method).
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public
HttpCodeException
(
String
code
,
String
message
)
{
super
(
code
,
message
);
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public
HttpCodeException
(
String
message
)
{
super
(
message
);
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public
HttpCodeException
(
Throwable
cause
)
{
super
(
cause
);
}
}
}
}
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