Package org.astrogrid.samp
Class ErrInfo
java.lang.Object
java.util.AbstractMap
org.astrogrid.samp.SampMap
org.astrogrid.samp.ErrInfo
- All Implemented Interfaces:
Map
Represents the error information associated with a SAMP response.
This corresponds to the
samp.error
entry in a response map.- Since:
- 14 Jul 2008
- Author:
- Mark Taylor
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Key for a numeric or textual code identifying the error.static final String
Key for debugging information such as a stack trace.static final String
Key for short description of what went wrong.static final String
Key for free-form text given more information about the error. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ErrInfo
Returns a given map as an ErrInfo object.void
check()
Checks that this object is ready for use with the SAMP toolkit.getCode()
Returns the value for theCODE_KEY
key.Returns the value for theDEBUGTXT_KEY
key.Returns the value for theERRORTXT_KEY
key.Returns the value for theUSERTXT_KEY
key.void
Sets the value for theCODE_KEY
key.void
setDebugtxt
(String debugtxt) Sets the value for theDEBUGTXT_KEY
key.void
setErrortxt
(String errortxt) Sets the value for theERRORTXT_KEY
key.void
setUsertxt
(String usertxt) Sets the value for theUSERTXT_KEY
key.Methods inherited from class org.astrogrid.samp.SampMap
checkHasKeys, entrySet, getList, getMap, getString, getUrl, put
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
ERRORTXT_KEY
Key for short description of what went wrong.- See Also:
-
USERTXT_KEY
Key for free-form text given more information about the error.- See Also:
-
DEBUGTXT_KEY
Key for debugging information such as a stack trace.- See Also:
-
CODE_KEY
Key for a numeric or textual code identifying the error.- See Also:
-
-
Constructor Details
-
ErrInfo
public ErrInfo()Constructs an empty ErrInfo. -
ErrInfo
Constructs an ErrInfo based on a given Throwable.- Parameters:
e
- error
-
ErrInfo
Constructs an ErrInfo based on an existing map.- Parameters:
map
- map containing initial data for this object
-
ErrInfo
Constructs an ErrInfo with a givenERRORTXT_KEY
value.- Parameters:
errortxt
- short string describing what went wrong
-
-
Method Details
-
setErrortxt
Sets the value for theERRORTXT_KEY
key.- Parameters:
errortxt
- short string describing what went wrong
-
getErrortxt
Returns the value for theERRORTXT_KEY
key.- Returns:
- short string describing what went wrong
-
setUsertxt
Sets the value for theUSERTXT_KEY
key.- Parameters:
usertxt
- free-form string giving more detail on the error
-
getUsertxt
Returns the value for theUSERTXT_KEY
key.- Returns:
- free-form string giving more detail on the error
-
setDebugtxt
Sets the value for theDEBUGTXT_KEY
key.- Parameters:
debugtxt
- string containing debugging information, such as a a stack trace
-
getDebugtxt
Returns the value for theDEBUGTXT_KEY
key.- Returns:
- string containing debugging information, such as a stack trace
-
setCode
Sets the value for theCODE_KEY
key.- Parameters:
code
- numeric or textual code identifying the error
-
getCode
Returns the value for theCODE_KEY
key.- Returns:
- numeric or textual code identifying the error
-
check
public void check()Description copied from class:SampMap
Checks that this object is ready for use with the SAMP toolkit. As well as callingSampUtils.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 informativeDataException
will be thrown. -
asErrInfo
Returns a given map as an ErrInfo object.- Parameters:
map
- map- Returns:
- errInfo
-