1 | /* |
---|
2 | * fmgVen - A Convention over Configuration Java ORM Tool |
---|
3 | * Copyright 2010 Fatih Mehmet Güler |
---|
4 | * |
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
---|
6 | * you may not use this file except in compliance with the License. |
---|
7 | * You may obtain a copy of the License at |
---|
8 | * |
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | * |
---|
11 | * Unless required by applicable law or agreed to in writing, software |
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | * See the License for the specific language governing permissions and |
---|
15 | * limitations under the License. |
---|
16 | * under the License. |
---|
17 | */ |
---|
18 | package com.fmguler.ven; |
---|
19 | |
---|
20 | /** |
---|
21 | * All kinds of exceptions in Ven operations. |
---|
22 | * @author Fatih Mehmet Güler |
---|
23 | */ |
---|
24 | public class VenException extends RuntimeException { |
---|
25 | private String errorCode; |
---|
26 | private String errorParam; |
---|
27 | //Error codes |
---|
28 | //"Invalid object, \"id\" property must be of integer type" |
---|
29 | public static final String EC_GENERATOR_OBJECT_ID_TYPE_INVALID = "ec-generator-object-id-type-invalid"; |
---|
30 | |
---|
31 | /** |
---|
32 | * Init VenException with an error code |
---|
33 | * @param errorCode the error code |
---|
34 | */ |
---|
35 | public VenException(String errorCode) { |
---|
36 | this.errorCode = errorCode; |
---|
37 | } |
---|
38 | |
---|
39 | /** |
---|
40 | * Init VenException with an error code and an error parameter |
---|
41 | * @param errorCode the error code |
---|
42 | * @param errorParam the error param |
---|
43 | */ |
---|
44 | public VenException(String errorCode, String errorParam) { |
---|
45 | this.errorCode = errorCode; |
---|
46 | this.errorParam = errorParam; |
---|
47 | } |
---|
48 | |
---|
49 | /** |
---|
50 | * Init VenException with an error code, error parameter and the cause of the exception |
---|
51 | * @param errorCode the error code |
---|
52 | * @param errorParam the error parameter |
---|
53 | * @param cause the cause of the exception |
---|
54 | */ |
---|
55 | public VenException(String errorCode, String errorParam, Throwable cause) { |
---|
56 | super(cause); |
---|
57 | this.errorCode = errorCode; |
---|
58 | this.errorParam = errorParam; |
---|
59 | } |
---|
60 | |
---|
61 | /** |
---|
62 | * @return the error code of the exception |
---|
63 | */ |
---|
64 | public String getErrorCode() { |
---|
65 | return errorCode; |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * @return the error parameter of the exception, which can contain details about the error |
---|
70 | */ |
---|
71 | public String getErrorParam() { |
---|
72 | return errorParam; |
---|
73 | } |
---|
74 | } |
---|