Class APIError

  • All Implemented Interfaces:
    FieldContainer, java.io.Serializable
    Direct Known Subclasses:
    APIInternalError

    public class APIError
    extends java.lang.Error
    implements FieldContainer
    Error indicating that a general API failure has occurred. No stack trace will be available with this Error or any of its sub-classes.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Throwable cause  
      protected java.util.List fields  
      protected java.lang.String message  
      protected boolean showStackTrace  
    • Constructor Summary

      Constructors 
      Constructor Description
      APIError()
      Default constructor.
      APIError​(java.lang.String msg)
      Default constructor with a message.
      APIError​(java.lang.Throwable cause)
      Default constructor wrapping a causal exception/error.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(Field field)
      Adds a new Field object to this Item.
      boolean contains​(java.lang.String id)
      Checks to see if a given Field with a particular ID exists in this container or not.
      java.lang.String getExceptionId()
      Retrieves the identifier of the exception that came from the API call.
      Field getField​(int idx)  
      Field getField​(java.lang.String name)
      Retrieves a Field object by name from this WorkItem.
      int getFieldListSize()
      Returns the size of all Field objects in the Item.
      java.util.Iterator getFields()
      Retrieves an Iterator over the list of Field objects stored in this WorkItem.
      java.lang.String getMessage()
      Retrieves the message component of the exception.
      void printStackTrace()  
      void printStackTrace​(java.io.PrintStream s)  
      void printStackTrace​(java.io.PrintWriter s)  
      void setMessage​(java.lang.String message)
      Sets the message of the exception.
      protected void setShowStackTrace​(boolean showStackTrace)
      Indicates if stack traces should be displayable or not.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • message

        protected java.lang.String message
      • fields

        protected java.util.List fields
      • showStackTrace

        protected boolean showStackTrace
      • cause

        protected java.lang.Throwable cause
    • Constructor Detail

      • APIError

        public APIError()
        Default constructor.
      • APIError

        public APIError​(java.lang.String msg)
        Default constructor with a message.
        Parameters:
        msg - The message associated with this APIError instance.
      • APIError

        public APIError​(java.lang.Throwable cause)
        Default constructor wrapping a causal exception/error.
        Parameters:
        cause - The linked Throwable cause.
    • Method Detail

      • getExceptionId

        public java.lang.String getExceptionId()
        Retrieves the identifier of the exception that came from the API call. The exception ID is the fully-qualified class name of the original exception.
        Returns:
        The identifier (fully-qualified class name) for the exception.
      • getMessage

        public java.lang.String getMessage()
        Retrieves the message component of the exception.
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        The message component of the exception.
      • setMessage

        public void setMessage​(java.lang.String message)
        Sets the message of the exception.
        Parameters:
        message - The message of the exception.
      • add

        public void add​(Field field)
        Adds a new Field object to this Item.
        Parameters:
        field - The Field object to add.
      • getField

        public Field getField​(java.lang.String name)
        Description copied from interface: FieldContainer
        Retrieves a Field object by name from this WorkItem. The lookup is case insensitive.
        Specified by:
        getField in interface FieldContainer
        Parameters:
        name - The ID of the Field to retrieve.
        Returns:
        The Field with the given ID.
      • getField

        public Field getField​(int idx)
      • getFields

        public java.util.Iterator getFields()
        Description copied from interface: FieldContainer
        Retrieves an Iterator over the list of Field objects stored in this WorkItem.
        Specified by:
        getFields in interface FieldContainer
        Returns:
        An Iterator over the list of Field objects.
      • getFieldListSize

        public int getFieldListSize()
        Description copied from interface: FieldContainer
        Returns the size of all Field objects in the Item.
        Specified by:
        getFieldListSize in interface FieldContainer
        Returns:
        The number of Field objects in the Item.
      • contains

        public boolean contains​(java.lang.String id)
        Description copied from interface: FieldContainer
        Checks to see if a given Field with a particular ID exists in this container or not. The lookup is case insensitive.
        Specified by:
        contains in interface FieldContainer
        Parameters:
        id - The Field ID to look for.
        Returns:
        true if there is a Field with the given ID; false otherwise.
      • printStackTrace

        public void printStackTrace()
        Overrides:
        printStackTrace in class java.lang.Throwable
      • printStackTrace

        public void printStackTrace​(java.io.PrintStream s)
        Overrides:
        printStackTrace in class java.lang.Throwable
      • printStackTrace

        public void printStackTrace​(java.io.PrintWriter s)
        Overrides:
        printStackTrace in class java.lang.Throwable
      • setShowStackTrace

        protected void setShowStackTrace​(boolean showStackTrace)
        Indicates if stack traces should be displayable or not.
        Parameters:
        showStackTrace - true if stack trace information should be displayed; false otherwise.