2 * Copyright 2017 Huawei Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openo.vnfsdk.marketplace.db.exception;
19 public class ErrorCodeException extends Exception {
21 private static final long serialVersionUID = 3220072444842529499L;
22 private int categoryCode = 0;
23 private int errorCode = 1;
24 private String[] arguments = null;
26 private static String defaultText = null;
29 public static void setDefaultText(String text) {
34 public static String getDefaultText() {
39 public ErrorCodeException(int code, String debugMessage) {
40 this(code, debugMessage, null);
44 * error code exception.
45 * @param code error code
46 * @param debugMessage debug message
47 * @param arguments arguments
49 public ErrorCodeException(int code, String debugMessage, String[] arguments) {
51 this.errorCode = code;
52 this.arguments = arguments;
56 public ErrorCodeException(Throwable source, int code) {
57 this(source, code, (String[]) null);
61 * error code exception.
62 * @param source Throwable
63 * @param code error code
64 * @param arguments arguments
66 public ErrorCodeException(Throwable source, int code, String[] arguments) {
68 this.errorCode = code;
69 this.arguments = arguments;
73 public ErrorCodeException(Throwable source, int code, String debugMessage) {
74 this(source, code, debugMessage, null);
78 * error code exception.
79 * @param source Throwable
80 * @param code error code
81 * @param debugMessage debug message
82 * @param arguments arguments
84 public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) {
85 super(debugMessage, source);
86 this.errorCode = code;
87 this.arguments = arguments;
91 public ErrorCodeException(int category, int code, String debugMessage) {
92 this(category, code, debugMessage, null);
96 public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) {
98 this.categoryCode = category;
99 this.errorCode = code;
100 this.arguments = arguments;
104 public ErrorCodeException(Throwable source, int category, int code) {
105 this(source, category, code, (String[]) null);
109 public ErrorCodeException(Throwable source, int category, int code, String[] arguments) {
111 this.categoryCode = category;
112 this.errorCode = code;
113 this.arguments = arguments;
117 public ErrorCodeException(Throwable source, int category, int code, String debugMessage) {
118 this(source, category, code, debugMessage, null);
122 public ErrorCodeException(Throwable source, int category, int code, String debugMessage,
123 String[] arguments) {
124 super(debugMessage, source);
125 this.categoryCode = category;
126 this.errorCode = code;
127 this.arguments = arguments;
131 public int getCategory() {
135 public int getErrorCode() {
140 public String[] getArguments() {