77afc6574a75e2fde29670cd6f0016ceabf64a45
[oam/tr069-adapter.git] / ves-agent / src / main / java / org / commscope / tr069adapter / vesagent / exception / VesAgentException.java
1 /*
2  * ============LICENSE_START========================================================================
3  * ONAP : tr-069-adapter
4  * =================================================================================================
5  * Copyright (C) 2020 CommScope Inc Intellectual Property.
6  * =================================================================================================
7  * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
9  * may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ===============LICENSE_END=======================================================================
17  */
18
19 package org.commscope.tr069adapter.vesagent.exception;\r
20 \r
21 /**\r
22  * \r
23  * @version 1.0\r
24  * @since May 21, 2020\r
25  * @author Prashant\r
26  */\r
27 public class VesAgentException extends Exception {\r
28   private static final long serialVersionUID = -3742697051389101875L;\r
29 \r
30   private static final String ERRORMSG_PREFIX = "ves-agent";\r
31 \r
32   private String[] arguments;\r
33 \r
34   private String errorCode;\r
35   private String message;\r
36 \r
37   // index of the error occurred in the given list or in the given file\r
38   protected int errorIndex = -1;\r
39 \r
40 \r
41   /**\r
42    * Constructs a <code>VesOperationException</code> with no detail message.\r
43    * \r
44    */\r
45   public VesAgentException() {\r
46     super();\r
47   }\r
48 \r
49   /**\r
50    * Constructs a <code>VesOperationException</code> with the specified detail message.\r
51    * \r
52    * @param s as the details message\r
53    */\r
54   public VesAgentException(String s) {\r
55     super(s);\r
56   }\r
57 \r
58   public VesAgentException(String... args) {\r
59     super();\r
60     arguments = args;\r
61     setErrorMessage(getErrorMessage());\r
62   }\r
63 \r
64   public VesAgentException(String errorCode, String errorMsg) {\r
65     super();\r
66     this.errorCode = errorCode;\r
67     setErrorMessage(getErrorMessage());\r
68   }\r
69 \r
70   public int getErrorIndex() {\r
71     return errorIndex;\r
72   }\r
73 \r
74   public void setErrorIndex(int errorIndex) {\r
75     this.errorIndex = errorIndex;\r
76   }\r
77 \r
78 \r
79   public String getMessage() {\r
80     return message;\r
81   }\r
82 \r
83   private String getErrorMessage() {\r
84     String key = ERRORMSG_PREFIX + ".";\r
85     return key;\r
86   }\r
87 \r
88   private void setErrorMessage(String message) {\r
89     this.message = message;\r
90   }\r
91 \r
92   public String getErrorCode() {\r
93     return errorCode;\r
94   }\r
95 \r
96   public void setErrorCode(String errorCode) {\r
97     this.errorCode = errorCode;\r
98   }\r
99 }\r