e7027377536415596c26fba7b475436d0f6af774
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.sdc.action.errors;
21
22 import org.openecomp.sdc.action.util.ActionUtil;
23
24 /**
25  * Custom Exception class for handling Action Library error scenarios.
26  */
27 public class ActionException extends RuntimeException {
28
29     private String errorCode;
30     private String description;
31     private int logResponseCode;
32
33     public ActionException() {
34     }
35
36     /**
37      * Instantiates a new Action exception.
38      *
39      * @param errorCode   the error code
40      * @param description the description
41      */
42     public ActionException(String errorCode, String description) {
43         this.errorCode = errorCode;
44         this.description = description;
45         this.logResponseCode = ActionUtil.getLogResponseCode(this.errorCode);
46     }
47
48     public String getErrorCode() {
49         return errorCode;
50     }
51
52     public void setErrorCode(String errorCode) {
53         this.errorCode = errorCode;
54     }
55
56     public String getDescription() {
57         return description;
58     }
59
60     public void setDescription(String description) {
61         this.description = description;
62     }
63
64     public int getLogResponseCode() {
65         return logResponseCode;
66     }
67
68     public void setLogResponseCode(int logResponseCode) {
69         this.logResponseCode = logResponseCode;
70     }
71 }