public class ErrInfo extends SampMap
samp.error
entry in a response map.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CODE_KEY
Key for a numeric or textual code identifying the error.
|
static java.lang.String |
DEBUGTXT_KEY
Key for debugging information such as a stack trace.
|
static java.lang.String |
ERRORTXT_KEY
Key for short description of what went wrong.
|
private static java.lang.String[] |
KNOWN_KEYS |
static java.lang.String |
USERTXT_KEY
Key for free-form text given more information about the error.
|
Constructor and Description |
---|
ErrInfo()
Constructs an empty ErrInfo.
|
ErrInfo(java.util.Map map)
Constructs an ErrInfo based on an existing map.
|
ErrInfo(java.lang.String errortxt)
Constructs an ErrInfo with a given
ERRORTXT_KEY value. |
ErrInfo(java.lang.Throwable e)
Constructs an ErrInfo based on a given Throwable.
|
Modifier and Type | Method and Description |
---|---|
static ErrInfo |
asErrInfo(java.util.Map map)
Returns a given map as an ErrInfo object.
|
void |
check()
Checks that this object is ready for use with the SAMP toolkit.
|
java.lang.String |
getCode()
Returns the value for the
CODE_KEY key. |
java.lang.String |
getDebugtxt()
Returns the value for the
DEBUGTXT_KEY key. |
java.lang.String |
getErrortxt()
Returns the value for the
ERRORTXT_KEY key. |
private static java.lang.String |
getStackTrace(java.lang.Throwable e)
Generates a string containing a stack trace for a given throwable.
|
java.lang.String |
getUsertxt()
Returns the value for the
USERTXT_KEY key. |
void |
setCode(java.lang.String code)
Sets the value for the
CODE_KEY key. |
void |
setDebugtxt(java.lang.String debugtxt)
Sets the value for the
DEBUGTXT_KEY key. |
void |
setErrortxt(java.lang.String errortxt)
Sets the value for the
ERRORTXT_KEY key. |
void |
setUsertxt(java.lang.String usertxt)
Sets the value for the
USERTXT_KEY key. |
checkHasKeys, entrySet, getList, getMap, getString, getUrl, put
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
public static final java.lang.String ERRORTXT_KEY
public static final java.lang.String USERTXT_KEY
public static final java.lang.String DEBUGTXT_KEY
public static final java.lang.String CODE_KEY
private static final java.lang.String[] KNOWN_KEYS
public ErrInfo()
public ErrInfo(java.lang.Throwable e)
e
- errorpublic ErrInfo(java.util.Map map)
map
- map containing initial data for this objectpublic ErrInfo(java.lang.String errortxt)
ERRORTXT_KEY
value.errortxt
- short string describing what went wrongpublic void setErrortxt(java.lang.String errortxt)
ERRORTXT_KEY
key.errortxt
- short string describing what went wrongpublic java.lang.String getErrortxt()
ERRORTXT_KEY
key.public void setUsertxt(java.lang.String usertxt)
USERTXT_KEY
key.usertxt
- free-form string giving more detail on the errorpublic java.lang.String getUsertxt()
USERTXT_KEY
key.public void setDebugtxt(java.lang.String debugtxt)
DEBUGTXT_KEY
key.debugtxt
- string containing debugging information, such as a
a stack tracepublic java.lang.String getDebugtxt()
DEBUGTXT_KEY
key.public void setCode(java.lang.String code)
CODE_KEY
key.code
- numeric or textual code identifying the errorpublic java.lang.String getCode()
CODE_KEY
key.public void check()
SampMap
SampUtils.checkMap(java.util.Map)
(ensuring that all keys
are Strings, and all values Strings, Lists or Maps), subclass-specific
invariants may be checked. In the case that there's something wrong,
an informative DataException
will be thrown.public static ErrInfo asErrInfo(java.util.Map map)
map
- mapprivate static java.lang.String getStackTrace(java.lang.Throwable e)
e
- error