CodeException.java 5.87 KB
Newer Older
yanzg's avatar
yanzg committed
1 2 3 4
package com.yanzuoguang.util.exception;

/**
 * 途比达异常信息
yanzg's avatar
yanzg committed
5
 *
yanzg's avatar
yanzg committed
6
 * @author 颜佐光
yanzg's avatar
yanzg committed
7
 */
yanzg's avatar
yanzg committed
8
public class CodeException extends RuntimeCodeException {
yanzg's avatar
yanzg committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

    /**
     * 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
     */
    public CodeException(String code, String message, Throwable cause) {
yanzg's avatar
yanzg committed
27
        super(code, message, cause);
yanzg's avatar
yanzg committed
28 29
    }

yanzg's avatar
yanzg committed
30 31 32 33 34 35 36 37 38
    /**
     * 构造函数
     * throw new CodeException("01","该订单已过期",order);
     * throw new CodeException("02","该订单未到使用时间",order);
     *
     * @param message  错误消息
     * @param target   错误数据源,如订单数据
     */
    public CodeException(String message, Object target) {
yanzg's avatar
yanzg committed
39
        super(message, target);
yanzg's avatar
yanzg committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
    }

    /**
     * 构造函数
     * throw new CodeException("01","该订单已过期",order);
     * throw new CodeException("02","该订单未到使用时间",order);
     *
     * @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 CodeException(String message, Object target, Throwable cause) {
yanzg's avatar
yanzg committed
55
        super(message, target, cause);
yanzg's avatar
yanzg committed
56 57
    }

yanzg's avatar
yanzg committed
58 59 60 61 62 63 64 65 66
    /**
     * 构造函数
     * throw new CodeException("01","该订单已过期",order);
     * throw new CodeException("02","该订单未到使用时间",order);
     *
     * @param code     错误码
     * @param message  错误消息
     * @param target   错误数据源,如订单数据
     */
yanzg's avatar
yanzg committed
67
    public CodeException(String code, String message, Object target) {
yanzg's avatar
yanzg committed
68
        super(code, message, target);
yanzg's avatar
yanzg committed
69 70
    }

yanzg's avatar
yanzg committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84
    /**
     * 构造函数
     * throw new CodeException("01","该订单已过期",order);
     * throw new CodeException("02","该订单未到使用时间",order);
     *
     * @param code     错误码
     * @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 CodeException(String code, String message, Object target, Throwable cause) {
yanzg's avatar
yanzg committed
85
        super(code, message, target, cause);
yanzg's avatar
yanzg committed
86 87
    }

yanzg's avatar
yanzg committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    /**
     * 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 CodeException(String message, Throwable cause) {
        super(message, cause);
    }


    /**
     * 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 CodeException() {
        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 CodeException(String code, String message) {
yanzg's avatar
yanzg committed
127
        super(code, message);
yanzg's avatar
yanzg committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
    }

    /**
     * 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 CodeException(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 CodeException(Throwable cause) {
        super(cause);
    }
}