Errors and Diagnostics

High-Level Errors

Managed constructors normally return undefined on failure; mutators usually return a boolean. A query has its own result contract. Capture diagnostic information immediately after the failed operation, before another Jolt call replaces or clears it.

APIContract
jolt_get_error()Snapshot struct with code, message and context (the managed operation name).
jolt_has_error()Whether the managed error code is nonzero.
jolt_get_error_message()Human-readable managed error message.
jolt_clear_error()Clears the managed error channel; does not repair the operation.
GML
var body = jolt_box_create_dynamic(0, 0, 2, 1, 1, 1);
if (is_undefined(body)) {
    var err = jolt_get_error();
    show_debug_message(err.context + ": " + err.message);
    exit;
}

Verified operation contracts#

These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.

Symbol / ownerSignatureOperation contract
jolt_clear_errorjolt_clear_error()Managed error state: Boolean / copied {code, message, context} / string / clear with no result. Reading does not clear it; subsequent operations can overwrite it. Distinct from native jolt_get_last_error_*.
jolt_get_errorjolt_get_error()Managed error state: Boolean / copied {code, message, context} / string / clear with no result. Reading does not clear it; subsequent operations can overwrite it. Distinct from native jolt_get_last_error_*.
jolt_get_error_messagejolt_get_error_message()Managed error state: Boolean / copied {code, message, context} / string / clear with no result. Reading does not clear it; subsequent operations can overwrite it. Distinct from native jolt_get_last_error_*.
jolt_has_errorjolt_has_error()Managed error state: Boolean / copied {code, message, context} / string / clear with no result. Reading does not clear it; subsequent operations can overwrite it. Distinct from native jolt_get_last_error_*.