-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorDetails.java
More file actions
105 lines (90 loc) · 3.11 KB
/
Copy pathErrorDetails.java
File metadata and controls
105 lines (90 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* Copyright (C) 2018 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.oidc.msg;
/**
* This class carries the information why a verification has failed for a specific parameter.
*/
public class ErrorDetails {
/** T * @param message The message describing the exception.
* @param cause The cause for this exception.
*/
private String parameterName;
/** The verification error type. */
private ErrorType errorType;
/** The optional message describing why verification failed. */
private String errorMessage;
/** The optional exception related to the verification failure. */
private Throwable errorCause;
/**
* Constructor.
* @param parameter The parameter name whose verification failed.
* @param type The verification error type.
*/
public ErrorDetails(String parameter, ErrorType type) {
this(parameter, type, null, null);
}
/**
* Constructor.
* @param parameter The parameter name whose verification failed.
* @param type The verification error type.
* @param message The optional message describing why verification failed.
*/
public ErrorDetails(String parameter, ErrorType type, String message) {
this(parameter, type, message, null);
}
/**
* Constructor.
* @param parameter The parameter name whose verification failed.
* @param type The verification error type.
* @param cause The optional exception related to the verification failure.
*/
public ErrorDetails(String parameter, ErrorType type, Throwable cause) {
this(parameter, type, null, cause);
}
/**
* Constructor.
* @param parameter The parameter name whose verification failed.
* @param type The verification error type.
* @param message The optional message describing why verification failed.
* @param cause The optional exception related to the verification failure.
*/
public ErrorDetails(String parameter, ErrorType type, String message, Throwable cause) {
parameterName = parameter;
errorType = type;
errorMessage = message;
errorCause = cause;
}
public String getParameterName() {
return parameterName;
}
public ErrorType getErrorType() {
return errorType;
}
public String getErrorMessage() {
return errorMessage;
}
public Throwable getErrorCause() {
return errorCause;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("parameterName=" + parameterName);
builder.append(", errorType=" + errorType);
builder.append(", errorMessage=" + errorMessage);
builder.append(", errorCause=" + errorCause);
return builder.toString();
}
}