d51efdfce1f70a92fe8a23f392ad8c619aa36e05
[oam/tr069-adapter.git] / ves-agent / src / main / java / org / commscope / tr069adapter / vesagent / exception / VesAgentException.java
1 package org.commscope.tr069adapter.vesagent.exception;\r
2 \r
3 /**\r
4  * \r
5  * @version 1.0\r
6  * @since May 21, 2020\r
7  * @author Prashant\r
8  */\r
9 public class VesAgentException extends Exception {\r
10   private static final long serialVersionUID = -3742697051389101875L;\r
11 \r
12   private static final String ERRORMSG_PREFIX = "ves-agent";\r
13 \r
14   private String[] arguments;\r
15 \r
16   private String errorCode;\r
17   private String message;\r
18 \r
19   // index of the error occurred in the given list or in the given file\r
20   protected int errorIndex = -1;\r
21 \r
22 \r
23   /**\r
24    * Constructs a <code>VesOperationException</code> with no detail message.\r
25    * \r
26    */\r
27   public VesAgentException() {\r
28     super();\r
29   }\r
30 \r
31   /**\r
32    * Constructs a <code>VesOperationException</code> with the specified detail message.\r
33    * \r
34    * @param s as the details message\r
35    */\r
36   public VesAgentException(String s) {\r
37     super(s);\r
38   }\r
39 \r
40   public VesAgentException(String... args) {\r
41     super();\r
42     arguments = args;\r
43     setErrorMessage(getErrorMessage());\r
44   }\r
45 \r
46   public VesAgentException(String errorCode, String errorMsg) {\r
47     super();\r
48     this.errorCode = errorCode;\r
49     setErrorMessage(getErrorMessage());\r
50   }\r
51 \r
52   public int getErrorIndex() {\r
53     return errorIndex;\r
54   }\r
55 \r
56   public void setErrorIndex(int errorIndex) {\r
57     this.errorIndex = errorIndex;\r
58   }\r
59 \r
60 \r
61   public String getMessage() {\r
62     return message;\r
63   }\r
64 \r
65   private String getErrorMessage() {\r
66     String key = ERRORMSG_PREFIX + ".";\r
67     return key;\r
68   }\r
69 \r
70   private void setErrorMessage(String message) {\r
71     this.message = message;\r
72   }\r
73 \r
74   public String getErrorCode() {\r
75     return errorCode;\r
76   }\r
77 \r
78   public void setErrorCode(String errorCode) {\r
79     this.errorCode = errorCode;\r
80   }\r
81 }\r