Class AnjayException

  • All Implemented Interfaces:
    java.io.Serializable

    public class AnjayException
    extends java.lang.RuntimeException
    An exception that encapsulates any error condition reported by the underlying native Anjay library.

    It may also be thrown from certain callback interfaces to pass an error condition into the native library.

    The static fields of this class may be used as errorCode() to represent a certain CoAP-level error code.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AnjayException​(int errorCode, java.lang.String message)
      Construct new AnjayException.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int errorCode()
      Retrieves the error code corresponding to a return value of a C function.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BAD_REQUEST

        public static final int BAD_REQUEST
      • UNAUTHORIZED

        public static final int UNAUTHORIZED
      • BAD_OPTION

        public static final int BAD_OPTION
      • NOT_FOUND

        public static final int NOT_FOUND
      • METHOD_NOT_ALLOWED

        public static final int METHOD_NOT_ALLOWED
      • NOT_ACCEPTABLE

        public static final int NOT_ACCEPTABLE
      • REQUEST_ENTITY_INCOMPLETE

        public static final int REQUEST_ENTITY_INCOMPLETE
      • INTERNAL

        public static final int INTERNAL
      • NOT_IMPLEMENTED

        public static final int NOT_IMPLEMENTED
      • SERVICE_UNAVAILABLE

        public static final int SERVICE_UNAVAILABLE
    • Constructor Detail

      • AnjayException

        public AnjayException​(int errorCode,
                              java.lang.String message)
        Construct new AnjayException.
        Parameters:
        errorCode - Error code that comes from or into native code, corresponding to a return value from a C function.
        message - The detail message. It is saved for later retrieval by the getMessage() method.
    • Method Detail

      • errorCode

        public int errorCode()
        Retrieves the error code corresponding to a return value of a C function.
        Returns:
        The error code. Usually a negative value.