Skip to content

Exceptions & Exception Handling in NAS2D

Leeor Dicker edited this page Mar 6, 2017 · 2 revisions

NAS2D defines a number of objects that are thrown when exceptions occur. These are derived from std::runtime_error() and are used to allow the end user to catch certain types of recoverable errors.

Filesystem

filesystem_backend_init_failure

Thrown when the Filesystem is unable to initialize itself.

filesystem_not_initialized

Thrown when any Filesystem function is called before the Filesystem::init() is called.

filesystem_already_initialized

Thrown when Filesystem::int() is called when the Filesystem is already initialized.

filesystem_file_handle_still_open

Thrown when the Filesystem tries to close a file handle but the operation fails.

Image Resource

image_bad_data

Thrown when an Image resource contains an invalid pixel buffer.

image_null_data

Thrown when an Image resource contains no data in its pixel buffer.

image_unsupported_bit_depth

Thrown when attempting to load or perform operations on an image file in an 8-bit or 16-bit format.

Mixer

mixer_backend_init_failure

Thrown when a derived Mixer type is unable to initialize itself.

Renderer

renderer_no_glsl

OpenGL Renderer throws this when no GLSL shading language is available.

renderer_backend_init_failure

Thrown when a derived Renderer type is unable to initialize itself.

renderer_window_creation_failure

Thrown when a window context can't be created.

renderer_opengl_context_failure

OpenGL Renderer throws this when an OpenGL context can't be created.

Clone this wiki locally