Class OA2GeneralError
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- edu.uiuc.ncsa.security.core.exceptions.GeneralException
-
- org.oa4mp.delegation.server.OA2GeneralError
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
OA2JSONException
,OA2RedirectableError
public class OA2GeneralError extends edu.uiuc.ncsa.security.core.exceptions.GeneralException
This is for use places where there is no redirect url available. Examples are the userInfo and getCert endpoints for OA4MP. It has an error and description but will be turned into a standard response with the given status code. It is up to any client to interpret this correctly.Created by Jeff Gaynor
on 10/22/15 at 11:18 AM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseClient
client
-
Constructor Summary
Constructors Constructor Description OA2GeneralError()
OA2GeneralError(OA2RedirectableError error)
Convert a redirectable error to a general one.OA2GeneralError(String message)
OA2GeneralError(String error, String description, int httpStatus, String state)
OA2GeneralError(String error, String description, int httpStatus, String state, BaseClient client)
OA2GeneralError(String message, Throwable cause)
OA2GeneralError(Throwable cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStackTraceToFM()
Appends the stack trace of this exception to the currentforensicMessage
.void
addStackTraceToFM(Throwable t)
Appends the stack trace of the givenThrowable
to the currentforensicMessage
.boolean
asJSON()
BaseClient
getClient()
String
getDescription()
String
getError()
String
getForensicMessage()
This is designed for a specific log message if there is an error.int
getHttpStatus()
String
getState()
boolean
hasClient()
boolean
hasForensicMessage()
void
setClient(BaseClient client)
void
setDescription(String description)
void
setError(String error)
void
setForensicMessage(String forensicMessage)
void
setHttpStatus(int httpStatus)
void
setState(String state)
void
setValues(String error, String description, int httpStatus, String state)
String
toString()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Field Detail
-
client
protected BaseClient client
-
-
Constructor Detail
-
OA2GeneralError
public OA2GeneralError(OA2RedirectableError error)
Convert a redirectable error to a general one. The default is to set the status code to 400 = bad request so something is there.- Parameters:
error
-
-
OA2GeneralError
public OA2GeneralError(Throwable cause)
-
OA2GeneralError
public OA2GeneralError()
-
OA2GeneralError
public OA2GeneralError(String message)
-
OA2GeneralError
public OA2GeneralError(String error, String description, int httpStatus, String state)
-
OA2GeneralError
public OA2GeneralError(String error, String description, int httpStatus, String state, BaseClient client)
-
-
Method Detail
-
hasClient
public boolean hasClient()
-
getClient
public BaseClient getClient()
-
setClient
public void setClient(BaseClient client)
-
getHttpStatus
public int getHttpStatus()
-
setHttpStatus
public void setHttpStatus(int httpStatus)
-
getState
public String getState()
-
setState
public void setState(String state)
-
getError
public String getError()
-
setError
public void setError(String error)
-
getDescription
public String getDescription()
-
setDescription
public void setDescription(String description)
-
asJSON
public boolean asJSON()
-
getForensicMessage
public String getForensicMessage()
This is designed for a specific log message if there is an error. It will simply be printed as is. In many cases, constructing a message for the logs can really only sensibly be done locally and propagating the exception will not allow for a good message. One issue we find repeatedly is that misbehaving clients cause errors hence a good deal of state needs to be encoded to help track these down.
A good forensic message should capture all that is needed to conclusively track down whatever the error is.
- Returns:
-
setForensicMessage
public void setForensicMessage(String forensicMessage)
-
addStackTraceToFM
public void addStackTraceToFM()
Appends the stack trace of this exception to the currentforensicMessage
.
-
addStackTraceToFM
public void addStackTraceToFM(Throwable t)
Appends the stack trace of the givenThrowable
to the currentforensicMessage
.- Parameters:
t
-
-
hasForensicMessage
public boolean hasForensicMessage()
-
-