|
Lines 36-52
Link Here
|
| 36 |
* Holds the current error or warning message. |
36 |
* Holds the current error or warning message. |
| 37 |
*/ |
37 |
*/ |
| 38 |
public final String message; |
38 |
public final String message; |
|
|
39 |
|
| 40 |
/** |
| 41 |
* Holds the exception that was thrown, if any. |
| 42 |
*/ |
| 43 |
public final Throwable exception; |
| 39 |
|
44 |
|
| 40 |
/** |
45 |
/** |
| 41 |
* A convenience factory for {@link #ERROR} ValidationErrors. |
46 |
* A convenience factory for {@link #ERROR} ValidationErrors. |
| 42 |
* |
47 |
* |
| 43 |
* @param message The error message |
48 |
* @param message The error message |
| 44 |
* @return A new ValidationError representing the error |
49 |
* @return A new ValidationError representing the error |
| 45 |
*/ |
50 |
*/ |
| 46 |
public static ValidationError error(String message) { |
51 |
public static ValidationError error(String message) { |
| 47 |
return new ValidationError(ERROR, message); |
52 |
return new ValidationError(ERROR, message, null); |
| 48 |
} |
53 |
} |
| 49 |
|
54 |
|
|
|
55 |
/** |
| 56 |
* A convenience factory for {@link #ERROR} ValidationErrors. |
| 57 |
* |
| 58 |
* @param message The error message |
| 59 |
* @param exception The exception that was thrown |
| 60 |
* @return A new ValidationError representing the error |
| 61 |
*/ |
| 62 |
public static ValidationError error(String message, Throwable exception) { |
| 63 |
return new ValidationError(ERROR, message, exception); |
| 64 |
} |
| 65 |
|
| 50 |
/** |
66 |
/** |
| 51 |
* A convenience factory for {@link #WARNING} ValidationErrors. |
67 |
* A convenience factory for {@link #WARNING} ValidationErrors. |
| 52 |
* |
68 |
* |
|
Lines 54-60
Link Here
|
| 54 |
* @return A new ValidationError representing the warning |
70 |
* @return A new ValidationError representing the warning |
| 55 |
*/ |
71 |
*/ |
| 56 |
public static ValidationError warning(String message) { |
72 |
public static ValidationError warning(String message) { |
| 57 |
return new ValidationError(WARNING, message); |
73 |
return new ValidationError(WARNING, message, null); |
| 58 |
} |
74 |
} |
| 59 |
|
75 |
|
| 60 |
/** |
76 |
/** |
|
Lines 62-71
Link Here
|
| 62 |
* |
78 |
* |
| 63 |
* @param status either {@link #WARNING} or {@link #ERROR} |
79 |
* @param status either {@link #WARNING} or {@link #ERROR} |
| 64 |
* @param message An error message string or warning. |
80 |
* @param message An error message string or warning. |
|
|
81 |
* @param exception The exception that was thrown or null. |
| 65 |
*/ |
82 |
*/ |
| 66 |
public ValidationError(int status, String message) { |
83 |
public ValidationError(int status, String message, Throwable exception) { |
| 67 |
this.status = status; |
84 |
this.status = status; |
| 68 |
this.message = message; |
85 |
this.message = message; |
|
|
86 |
this.exception = exception; |
| 69 |
} |
87 |
} |
| 70 |
|
88 |
|
| 71 |
public String toString() { |
89 |
public String toString() { |