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.onap.vnfsdk.marketplace.db.exception;
19 public class ErrorCodeException extends Exception {
21 private static final long serialVersionUID = 3220072444842529499L;
22 private final int categoryCode;
23 private final int errorCode;
24 private final String[] arguments;
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;
53 this.categoryCode = 0;
57 public ErrorCodeException(Throwable source, int code) {
58 this(source, code, (String[]) null);
62 * error code exception.
63 * @param source Throwable
64 * @param code error code
65 * @param arguments arguments
67 public ErrorCodeException(Throwable source, int code, String[] arguments) {
69 this.errorCode = code;
70 this.arguments = arguments;
71 this.categoryCode = 0;
75 public ErrorCodeException(Throwable source, int code, String debugMessage) {
76 this(source, code, debugMessage, null);
80 * error code exception.
81 * @param source Throwable
82 * @param code error code
83 * @param debugMessage debug message
84 * @param arguments arguments
86 public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) {
87 super(debugMessage, source);
88 this.errorCode = code;
89 this.arguments = arguments;
90 this.categoryCode = 0;
94 public ErrorCodeException(int category, int code, String debugMessage) {
95 this(category, code, debugMessage, null);
99 public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) {
101 this.categoryCode = category;
102 this.errorCode = code;
103 this.arguments = arguments;
107 public ErrorCodeException(Throwable source, int category, int code) {
108 this(source, category, code, (String[]) null);
112 public ErrorCodeException(Throwable source, int category, int code, String[] arguments) {
114 this.categoryCode = category;
115 this.errorCode = code;
116 this.arguments = arguments;
120 public ErrorCodeException(Throwable source, int category, int code, String debugMessage) {
121 this(source, category, code, debugMessage, null);
125 public ErrorCodeException(Throwable source, int category, int code, String debugMessage,
126 String[] arguments) {
127 super(debugMessage, source);
128 this.categoryCode = category;
129 this.errorCode = code;
130 this.arguments = arguments;
134 public int getCategory() {
138 public int getErrorCode() {
143 public String[] getArguments() {