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 StringKey for a numeric or textual code identifying the error.static final StringKey for debugging information such as a stack trace.static final StringKey for short description of what went wrong.static final StringKey for free-form text given more information about the error. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ErrInfoReturns a given map as an ErrInfo object.voidcheck()Checks that this object is ready for use with the SAMP toolkit.getCode()Returns the value for theCODE_KEYkey.Returns the value for theDEBUGTXT_KEYkey.Returns the value for theERRORTXT_KEYkey.Returns the value for theUSERTXT_KEYkey.voidSets the value for theCODE_KEYkey.voidsetDebugtxt(String debugtxt) Sets the value for theDEBUGTXT_KEYkey.voidsetErrortxt(String errortxt) Sets the value for theERRORTXT_KEYkey.voidsetUsertxt(String usertxt) Sets the value for theUSERTXT_KEYkey.Methods inherited from class org.astrogrid.samp.SampMap
checkHasKeys, entrySet, getList, getMap, getString, getUrl, putMethods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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_KEYvalue.- Parameters:
errortxt- short string describing what went wrong
-
-
Method Details
-
setErrortxt
Sets the value for theERRORTXT_KEYkey.- Parameters:
errortxt- short string describing what went wrong
-
getErrortxt
Returns the value for theERRORTXT_KEYkey.- Returns:
- short string describing what went wrong
-
setUsertxt
Sets the value for theUSERTXT_KEYkey.- Parameters:
usertxt- free-form string giving more detail on the error
-
getUsertxt
Returns the value for theUSERTXT_KEYkey.- Returns:
- free-form string giving more detail on the error
-
setDebugtxt
Sets the value for theDEBUGTXT_KEYkey.- Parameters:
debugtxt- string containing debugging information, such as a a stack trace
-
getDebugtxt
Returns the value for theDEBUGTXT_KEYkey.- Returns:
- string containing debugging information, such as a stack trace
-
setCode
Sets the value for theCODE_KEYkey.- Parameters:
code- numeric or textual code identifying the error
-
getCode
Returns the value for theCODE_KEYkey.- Returns:
- numeric or textual code identifying the error
-
check
public void check()Description copied from class:SampMapChecks 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 informativeDataExceptionwill be thrown. -
asErrInfo
Returns a given map as an ErrInfo object.- Parameters:
map- map- Returns:
- errInfo
-