Errors

Overview

Every function in the JanICE C API returns an error code when executed. In the case of successful application JANICE_SUCCESS is returned, otherwise a code indicating the specific issue is returned. The error codes are enumerated using the JaniceError type.

Enumerations

JaniceError

The error codes defined in the JanICE C API

Code Description
JANICE_SUCCESS No error
JANICE_UNKNOWN_ERROR Catch all error code
JANICE_OUT_OF_MEMORY Out of memory error
JANICE_INVALID_SDK_PATH Invalid SDK location
JANICE_BAD_SDK_CONFIG Invalid SDK configuration
JANICE_BAD_LICENSE Incorrect license file
JANICE_MISSING_DATA Missing SDK data
JANICE_INVALID_GPU The GPU is not functioning
JANICE_BAD_ARGUMENT An argument to a JanICE function is invalid
JANICE_OPEN_ERROR Failed to open a file
JANICE_READ_ERROR Failed to read from a file
JANICE_WRITE_ERROR Failed to write to a file
JANICE_PARSE_ERROR Failed to parse a file
JANICE_INVALID_MEDIA Failed to decode a media file
JANICE_OUT_OF_BOUNDS_ACCESS Out of bounds access into a buffer.
JANICE_MEDIA_AT_END A media iterator has reached the end of its data.
JANICE_INVALID_ATTRIBUTE_KEY An invalid attribute key was provided.
JANICE_MISSING_ATTRIBUTE A value for a valid attribute key is not available.
JANICE_DUPLICATE_ID Template id already exists in a gallery
JANICE_MISSING_ID Template id can’t be found
JANICE_MISSING_FILE_NAME An expected file name is not given
JANICE_INCORRECT_ROLE Incorrect template role
JANICE_FAILURE_TO_SERIALIZE Could not serialize a data structure
JANICE_FAILURE_TO_DESERIALIZE Could not deserialize a data structure
JANICE_NOT_IMPLEMENTED Optional function return
JANICE_NUM_ERRORS Utility to iterate over all errors

Functions

janice_error_to_string

Convert a JaniceError into a string for printing.

Signature

JANICE_EXPORT const char* janice_error_to_string(JaniceError error);

Thread Safety

This function is Thread Safe.

Parameters

Name Type Description
error JaniceError An error code

Return Value

This is the only function in the API that does not return JaniceError. It returns const char* which is a null-terminated list of characters that describe the input error.