Class 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
    • 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 message,
                               Throwable cause)
      • OA2GeneralError

        public OA2GeneralError​(String error,
                               String description,
                               int httpStatus,
                               String state)
    • Method Detail

      • hasClient

        public boolean hasClient()
      • setClient

        public void setClient​(BaseClient client)
      • setValues

        public void setValues​(String error,
                              String description,
                              int httpStatus,
                              String state)
      • 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 current forensicMessage.
      • addStackTraceToFM

        public void addStackTraceToFM​(Throwable t)
        Appends the stack trace of the given Throwable to the current forensicMessage.
        Parameters:
        t -
      • hasForensicMessage

        public boolean hasForensicMessage()