Package com.mks.api.response
Class APIError
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Error
-
- com.mks.api.response.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 thisError
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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Field field)
Adds a newField
object to thisItem
.boolean
contains(java.lang.String id)
Checks to see if a givenField
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 aField
object by name from thisWorkItem
.int
getFieldListSize()
Returns the size of allField
objects in theItem
.java.util.Iterator
getFields()
Retrieves anIterator
over the list ofField
objects stored in thisWorkItem
.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.
-
-
-
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 linkedThrowable
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 classjava.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 newField
object to thisItem
.- Parameters:
field
- TheField
object to add.
-
getField
public Field getField(java.lang.String name)
Description copied from interface:FieldContainer
Retrieves aField
object by name from thisWorkItem
. The lookup is case insensitive.- Specified by:
getField
in interfaceFieldContainer
- Parameters:
name
- The ID of theField
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 anIterator
over the list ofField
objects stored in thisWorkItem
.- Specified by:
getFields
in interfaceFieldContainer
- Returns:
- An
Iterator
over the list ofField
objects.
-
getFieldListSize
public int getFieldListSize()
Description copied from interface:FieldContainer
Returns the size of allField
objects in theItem
.- Specified by:
getFieldListSize
in interfaceFieldContainer
- Returns:
- The number of
Field
objects in theItem
.
-
contains
public boolean contains(java.lang.String id)
Description copied from interface:FieldContainer
Checks to see if a givenField
with a particular ID exists in this container or not. The lookup is case insensitive.- Specified by:
contains
in interfaceFieldContainer
- Parameters:
id
- TheField
ID to look for.- Returns:
true
if there is aField
with the given ID;false
otherwise.
-
printStackTrace
public void printStackTrace()
- Overrides:
printStackTrace
in classjava.lang.Throwable
-
printStackTrace
public void printStackTrace(java.io.PrintStream s)
- Overrides:
printStackTrace
in classjava.lang.Throwable
-
printStackTrace
public void printStackTrace(java.io.PrintWriter s)
- Overrides:
printStackTrace
in classjava.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.
-
-