Class 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
  • Field Details

    • ERRORTXT_KEY

      public static final String ERRORTXT_KEY
      Key for short description of what went wrong.
      See Also:
    • USERTXT_KEY

      public static final String USERTXT_KEY
      Key for free-form text given more information about the error.
      See Also:
    • DEBUGTXT_KEY

      public static final String DEBUGTXT_KEY
      Key for debugging information such as a stack trace.
      See Also:
    • CODE_KEY

      public static final String CODE_KEY
      Key for a numeric or textual code identifying the error.
      See Also:
  • 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