b.janani | e6d43af | 2016-03-04 12:29:05 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
b.janani | e6d43af | 2016-03-04 12:29:05 +0530 | [diff] [blame] | 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.yangutils.translator.exception; |
| 18 | |
| 19 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame^] | 20 | * Represents custom translator exception for translator's operations. |
b.janani | e6d43af | 2016-03-04 12:29:05 +0530 | [diff] [blame] | 21 | */ |
| 22 | public class TranslatorException extends RuntimeException { |
| 23 | |
| 24 | private static final long serialVersionUID = 20160311L; |
| 25 | private String fileName; |
| 26 | |
| 27 | /** |
| 28 | * Create a new translator exception. |
| 29 | */ |
| 30 | public TranslatorException() { |
| 31 | super(); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Creates a new translator exception with given message. |
| 36 | * |
| 37 | * @param message the detail of exception in string |
| 38 | */ |
| 39 | public TranslatorException(String message) { |
| 40 | super(message); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Creates a new translator exception from given message and cause. |
| 45 | * |
| 46 | * @param message the detail of exception in string |
| 47 | * @param cause underlying cause of the error |
| 48 | */ |
| 49 | public TranslatorException(final String message, final Throwable cause) { |
| 50 | super(message, cause); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Creates a new translator exception from cause. |
| 55 | * |
| 56 | * @param cause underlying cause of the error |
| 57 | */ |
| 58 | public TranslatorException(final Throwable cause) { |
| 59 | super(cause); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Returns generated file name for the exception. |
| 64 | * |
| 65 | * @return generated file name for the exception |
| 66 | */ |
| 67 | public String getFileName() { |
| 68 | return this.fileName; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Sets file name in translator exception. |
| 73 | * |
| 74 | * @param fileName generated file name |
| 75 | */ |
| 76 | public void setFileName(String fileName) { |
| 77 | this.fileName = fileName; |
| 78 | } |
| 79 | } |