Package org.oa4mp.delegation.server
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.GeneralExceptionThis 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 org.oa4mp.delegation.common.storage.clients.BaseClientclient
-
Constructor Summary
Constructors Constructor Description OA2GeneralError()OA2GeneralError(String message)OA2GeneralError(String error, String description, int httpStatus, String state)OA2GeneralError(String error, String description, int httpStatus, String state, org.oa4mp.delegation.common.storage.clients.BaseClient client)OA2GeneralError(String message, Throwable cause)OA2GeneralError(Throwable cause)OA2GeneralError(OA2RedirectableError error)Convert a redirectable error to a general one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStackTraceToFM()Appends the stack trace of this exception to the currentforensicMessage.voidaddStackTraceToFM(Throwable t)Appends the stack trace of the givenThrowableto the currentforensicMessage.booleanasJSON()org.oa4mp.delegation.common.storage.clients.BaseClientgetClient()StringgetDescription()StringgetError()StringgetForensicMessage()This is designed for a specific log message if there is an error.intgetHttpStatus()StringgetState()booleanhasClient()booleanhasForensicMessage()voidsetClient(org.oa4mp.delegation.common.storage.clients.BaseClient client)voidsetDescription(String description)voidsetError(String error)voidsetForensicMessage(String forensicMessage)voidsetHttpStatus(int httpStatus)voidsetState(String state)voidsetValues(String error, String description, int httpStatus, String state)StringtoString()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
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)
-
-
Method Detail
-
hasClient
public boolean hasClient()
-
getClient
public org.oa4mp.delegation.common.storage.clients.BaseClient getClient()
-
setClient
public void setClient(org.oa4mp.delegation.common.storage.clients.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 givenThrowableto the currentforensicMessage.- Parameters:
t-
-
hasForensicMessage
public boolean hasForensicMessage()
-
-