# Class NearbyException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.codename1.nearby.NearbyException

public class NearbyException extends Exception
Thrown through the failure path of every `AsyncResource` returned by the `com.codename1.nearby` APIs, and passed to the failure callbacks of the ranging and transport listeners. `getError()` returns a typed `NearbyError` so callers react without string-matching the message.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NearbyException(NearbyError error)`
  `NearbyException(NearbyError error, String message)`
  `NearbyException(NearbyError error, String message, Throwable cause)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `NearbyError`
  `getError()`
  Typed error code describing the failure.

  ### Methods inherited from class Throwable

  `addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NearbyException

    public NearbyException(NearbyError error)

  - ### NearbyException

    public NearbyException(NearbyError error, String message)

  - ### NearbyException

    public NearbyException(NearbyError error, String message, Throwable cause)

- ## Method Details

  - ### getError

    public NearbyError getError()
    Typed error code describing the failure. Never `null`.