85bc33fbb26d8bff081d29581940dca3ff8258ef
[onosfw.git] /
1 /*
2  * Copyright 2015 Open Networking Laboratory
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onosproject.pcepio.exceptions;
18
19 /**
20  * Custom Exception for PCEP IO.
21  */
22 public class PcepParseException extends Exception {
23
24     private static final long serialVersionUID = 7960991379951448423L;
25     private byte errType = 0;
26     private byte errValue = 0;
27
28     /**
29      * Default constructor to create a new exception.
30      */
31     public PcepParseException() {
32         super();
33     }
34
35     /**
36      * Constructor to create exception from message and cause.
37      *
38      * @param message the detail of exception in string
39      * @param cause underlying cause of the error
40      */
41     public PcepParseException(final String message, final Throwable cause) {
42         super(message, cause);
43     }
44
45     /**
46      * Constructor to create exception from message.
47      *
48      * @param message the detail of exception in string
49      */
50     public PcepParseException(final String message) {
51         super(message);
52     }
53
54     /**
55      * Constructor to create exception from error type and error value.
56      *
57      * @param errType error type of pcep
58      * @param errValue error value of pcep
59      */
60     public PcepParseException(final byte errType, final byte errValue) {
61         super();
62         this.errType = errType;
63         this.errValue = errValue;
64     }
65
66     /**
67      * Constructor to create exception from cause.
68      *
69      * @param cause underlying cause of the error
70      */
71     public PcepParseException(final Throwable cause) {
72         super(cause);
73     }
74
75     /**
76      * Returns error type for this exception.
77      *
78      * @return ErrorType
79      */
80     public byte getErrorType() {
81         return this.errType;
82     }
83
84     /**
85      * Returns error value for this exception.
86      *
87      * @return ErrorValue
88      */
89     public byte getErrorValue() {
90         return this.errValue;
91     }
92 }