Package ej.microui

## Class MicroUIException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - ej.microui.MicroUIException

- All Implemented Interfaces:
    `Serializable`

      public class MicroUIException
      extends RuntimeException

  Thrown to indicate that a method has caused an internal MicroUI error. This error is specified by an identifier and this identifier can be retrieved calling `getErrorCode()`.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DISPLAY_DEADLOCK` | Exception thrown when trying to wait for an event in the same thread that treats events (Deadlock).
    `static int` | `DRAWING_ERROR` | Exception thrown if the error flag was set during a drawing operation.
    `static int` | `EVENTGENERATOR_POOL_FULL` | Exception thrown when the pool of `EventGenerator` is full.
    `static int` | `GENERIC_EVENT_GENERATOR_INVALID_CLASSNAME` | Exception thrown when generic event generator classname is unknown.
    `static int` | `IMAGE_OUT_OF_MEMORY` | Exception thrown when there is not enough space in images heap when creating a new image.
    `static int` | `IMAGE_UNKNOWN_FORMAT` | Exception thrown when the image cannot be decoded because there is no runtime decoder able to decode this kind of image.
    `static int` | `IMAGE_UNSUPPORTED_FORMAT` | Exception thrown if the format is not supported when creating an image or graphics context.
    `static int` | `MICROUI_NOT_STARTED` | Exception thrown when trying to use MicroUI APIs without starting it before.
    `static int` | `NO_DISPLAY` | Exception thrown when the application tries to get a `Display` whereas there is no `Display` on the platform.
    `static int` | `NO_FONT` | Exception thrown when the application tries to get a `Font` whereas there is no `Font` on the platform.
    `static int` | `OUT_OF_EVENTS` | Exception thrown when `Display`'s event serializer queue is full.
    `static int` | `RESOURCE_CLOSED` | Exception thrown when the application is trying to use a resource which has been closed.
    `static int` | `RESOURCE_INVALID_FILE` | Exception thrown when the resource content cannot be read for any reason.
    `static int` | `RESOURCE_INVALID_PATH` | Exception thrown when a resource cannot be retrieved.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MicroUIException​(int errorCode)` | Constructs an exception with the specified error code.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getErrorCode()` | Gets the reason why the exception has been thrown.

    - ### Methods inherited from class java.lang.Throwable

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

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### MICROUI_NOT_STARTED

          public static final int MICROUI_NOT_STARTED

      Exception thrown when trying to use MicroUI APIs without starting it before.

      Value `-1` is assigned to `MICROUI_NOT_STARTED`.

      See Also:
        `MicroUI.start()`, `MicroUI.stop()`, `MicroUI.isStarted()`, Constant Field Values

    - #### GENERIC_EVENT_GENERATOR_INVALID_CLASSNAME

          public static final int GENERIC_EVENT_GENERATOR_INVALID_CLASSNAME

      Exception thrown when generic event generator classname is unknown. Please check your classpath to add the expected class.

      Value `-2` is assigned to `GENERIC_EVENT_GENERATOR_INVALID_CLASSNAME`.

      See Also:
        Constant Field Values

    - #### DISPLAY_DEADLOCK

          public static final int DISPLAY_DEADLOCK

      Exception thrown when trying to wait for an event in the same thread that treats events (Deadlock).

      Value `-3` is assigned to `DISPLAY_DEADLOCK`.

      See Also:
        `MicroUI.isUIThread()`, `MicroUI.isUIThread(Thread)`, Constant Field Values

    - #### RESOURCE_INVALID_PATH

          public static final int RESOURCE_INVALID_PATH

      Exception thrown when a resource cannot be retrieved. Path must be relative to the application classpath and starts with '/'.

      Value `-4` is assigned to `RESOURCE_INVALID_PATH`.

      See Also:
        Constant Field Values

    - #### RESOURCE_INVALID_FILE

          public static final int RESOURCE_INVALID_FILE

      Exception thrown when the resource content cannot be read for any reason.

      Value `-5` is assigned to `RESOURCE_INVALID_FILE`.

      See Also:
        Constant Field Values

    - #### RESOURCE_CLOSED

          public static final int RESOURCE_CLOSED

      Exception thrown when the application is trying to use a resource which has been closed.

      Value `-6` is assigned to `RESOURCE_CLOSED`.

      See Also:
        Constant Field Values

    - #### IMAGE_OUT_OF_MEMORY

          public static final int IMAGE_OUT_OF_MEMORY

      Exception thrown when there is not enough space in images heap when creating a new image.

      Value `-7` is assigned to `IMAGE_OUT_OF_MEMORY`.

      See Also:
        Constant Field Values

    - #### IMAGE_UNKNOWN_FORMAT

          public static final int IMAGE_UNKNOWN_FORMAT

      Exception thrown when the image cannot be decoded because there is no runtime decoder able to decode this kind of image.

      Value `-8` is assigned to `IMAGE_UNKNOWN_FORMAT`.

      See Also:
        Constant Field Values

    - #### OUT_OF_EVENTS

          public static final int OUT_OF_EVENTS

      Exception thrown when `Display`'s event serializer queue is full. The new event cannot be added to this queue. Review the queue size or decrease the number of events added to this queue.

      Value `-9` is assigned to `OUT_OF_EVENTS`.

      See Also:
        Constant Field Values

    - #### NO_DISPLAY

          public static final int NO_DISPLAY

      Exception thrown when the application tries to get a `Display` whereas there is no `Display` on the platform.

      Value `-10` is assigned to `NO_DISPLAY`.

      See Also:
        Constant Field Values

    - #### NO_FONT

          public static final int NO_FONT

      Exception thrown when the application tries to get a `Font` whereas there is no `Font` on the platform.

      Value `-11` is assigned to `NO_FONT`.

      See Also:
        Constant Field Values

    - #### EVENTGENERATOR_POOL_FULL

          public static final int EVENTGENERATOR_POOL_FULL

      Exception thrown when the pool of `EventGenerator` is full.

      Value `-12` is assigned to `EVENTGENERATOR_POOL_FULL`.

      See Also:
        `EventGenerator.addToSystemPool()`, Constant Field Values

    - #### DRAWING_ERROR

          public static final int DRAWING_ERROR

      Exception thrown if the error flag was set during a drawing operation. The check is performed when the screen is flushed or when explicitly requested.

      Value `-13` is assigned to `DRAWING_ERROR`.

      See Also:
        Constant Field Values

    - #### IMAGE_UNSUPPORTED_FORMAT

          public static final int IMAGE_UNSUPPORTED_FORMAT

      Exception thrown if the format is not supported when creating an image or graphics context.

      Value `-14` is assigned to `IMAGE_UNSUPPORTED_FORMAT`.

      See Also:
        `BufferedImage(int, int, Format)`, Constant Field Values

  - ### Constructor Detail

    - #### MicroUIException

          public MicroUIException​(int errorCode)

      Constructs an exception with the specified error code.
      Parameters:
        `errorCode` - the exception error code

  - ### Method Detail

    - #### getErrorCode

          public int getErrorCode()

      Gets the reason why the exception has been thrown.
      Returns:
        the exception error code