Package org.astrogrid.samp

# Class ErrInfo

java.lang.Object
java.util.AbstractMap
org.astrogrid.samp.SampMap
org.astrogrid.samp.ErrInfo

All Implemented Interfaces:
  `Map`

public class ErrInfo extends SampMap
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>`

## Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K,V>`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CODE_KEY`
Key for a numeric or textual code identifying the error.
`static final String`
`DEBUGTXT_KEY`
Key for debugging information such as a stack trace.
`static final String`
`ERRORTXT_KEY`
Key for short description of what went wrong.
`static final String`
`USERTXT_KEY`
Key for free-form text given more information about the error.

### Fields inherited from class org.astrogrid.samp.SampMap

`EMPTY`

## Constructor Summary

Constructors
Constructor
Description
`ErrInfo()`
Constructs an empty ErrInfo.
`ErrInfo(String errortxt)`
Constructs an ErrInfo with a given `ERRORTXT_KEY` value.
`ErrInfo(Throwable e)`
Constructs an ErrInfo based on a given Throwable.
`ErrInfo(Map map)`
Constructs an ErrInfo based on an existing map.

## Method Summary

Modifier and Type
Method
Description
`static ErrInfo`
`asErrInfo(Map map)`
Returns a given map as an ErrInfo object.
`void`
`check()`
Checks that this object is ready for use with the SAMP toolkit.
`String`
`getCode()`
Returns the value for the `CODE_KEY` key.
`String`
`getDebugtxt()`
Returns the value for the `DEBUGTXT_KEY` key.
`String`
`getErrortxt()`
Returns the value for the `ERRORTXT_KEY` key.
`String`
`getUsertxt()`
Returns the value for the `USERTXT_KEY` key.
`void`
`setCode(String code)`
Sets the value for the `CODE_KEY` key.
`void`
`setDebugtxt(String debugtxt)`
Sets the value for the `DEBUGTXT_KEY` key.
`void`
`setErrortxt(String errortxt)`
Sets the value for the `ERRORTXT_KEY` key.
`void`
`setUsertxt(String usertxt)`
Sets the value for the `USERTXT_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

public static final String ERRORTXT_KEY
Key for short description of what went wrong.

See Also:
  - Constant Field Values

### USERTXT_KEY

public static final String USERTXT_KEY
Key for free-form text given more information about the error.

See Also:
  - Constant Field Values

### DEBUGTXT_KEY

public static final String DEBUGTXT_KEY
Key for debugging information such as a stack trace.

See Also:
  - Constant Field Values

### CODE_KEY

public static final String CODE_KEY
Key for a numeric or textual code identifying the error.

See Also:
  - Constant Field Values

## Constructor Details

### ErrInfo

public ErrInfo()
Constructs an empty ErrInfo.

### ErrInfo

public ErrInfo(Throwable e)
Constructs an ErrInfo based on a given Throwable.

Parameters:
  `e` - error

### ErrInfo

public ErrInfo(Map map)
Constructs an ErrInfo based on an existing map.

Parameters:
  `map` - map containing initial data for this object

### ErrInfo

public ErrInfo(String errortxt)
Constructs an ErrInfo with a given `ERRORTXT_KEY` value.

Parameters:
  `errortxt` - short string describing what went wrong

## Method Details

### setErrortxt

public void setErrortxt(String errortxt)
Sets the value for the `ERRORTXT_KEY` key.

Parameters:
  `errortxt` - short string describing what went wrong

### getErrortxt

public String getErrortxt()
Returns the value for the `ERRORTXT_KEY` key.

Returns:
  short string describing what went wrong

### setUsertxt

public void setUsertxt(String usertxt)
Sets the value for the `USERTXT_KEY` key.

Parameters:
  `usertxt` - free-form string giving more detail on the error

### getUsertxt

public String getUsertxt()
Returns the value for the `USERTXT_KEY` key.

Returns:
  free-form string giving more detail on the error

### setDebugtxt

public void setDebugtxt(String debugtxt)
Sets the value for the `DEBUGTXT_KEY` key.

Parameters:
  `debugtxt` - string containing debugging information, such as a a stack trace

### getDebugtxt

public String getDebugtxt()
Returns the value for the `DEBUGTXT_KEY` key.

Returns:
  string containing debugging information, such as a stack trace

### setCode

public void setCode(String code)
Sets the value for the `CODE_KEY` key.

Parameters:
  `code` - numeric or textual code identifying the error

### getCode

public String getCode()
Returns the value for the `CODE_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 calling `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.

Overrides:
  `check` in class `SampMap`

### asErrInfo

public static ErrInfo asErrInfo(Map map)
Returns a given map as an ErrInfo object.

Parameters:
  `map` - map
Returns:
  errInfo