# Class VisionException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.codename1.ai.vision.VisionException

public class VisionException extends RuntimeException
Failure reported by an on-device vision backend.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `BACKEND_ERROR`
  `static final int`
  `CANCELLED`
  `static final int`
  `INVALID_IMAGE`
  `static final int`
  `MODEL_UNAVAILABLE`
  `static final int`
  `UNSUPPORTED`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VisionException(int code, String message)`
  Creates a classified vision failure.
  `VisionException(int code, String message, Throwable cause)`
  Creates a classified vision failure with its native or port cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getCode()`

  ### Methods inherited from class Throwable

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

  ### Methods inherited from class Object

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

- ## Field Details

  - ### UNSUPPORTED

    public static final int UNSUPPORTED
    See Also:
      - Constant Field Values

  - ### INVALID_IMAGE

    public static final int INVALID_IMAGE
    See Also:
      - Constant Field Values

  - ### MODEL_UNAVAILABLE

    public static final int MODEL_UNAVAILABLE
    See Also:
      - Constant Field Values

  - ### CANCELLED

    public static final int CANCELLED
    See Also:
      - Constant Field Values

  - ### BACKEND_ERROR

    public static final int BACKEND_ERROR
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### VisionException

    public VisionException(int code, String message)
    Creates a classified vision failure.
    Parameters:
      `code` - portable failure code defined by this class
      `message` - user-readable failure description

  - ### VisionException

    public VisionException(int code, String message, Throwable cause)
    Creates a classified vision failure with its native or port cause.
    Parameters:
      `code` - portable failure code defined by this class
      `message` - user-readable failure description
      `cause` - originating detector or image-conversion error

- ## Method Details

  - ### getCode

    public int getCode()
    Returns:
      one of this class's portable failure-code constants