Function imageflow::imageflow_context_raise_error
[−]
[src]
#[no_mangle]pub unsafe extern fn imageflow_context_raise_error(context: *mut Context,
error_code: i32,
message: *const c_char,
filename: *const c_char,
line: i32,
function_name: *const c_char)
-> bool
Raises an error on the context.
Returns true
on success, false
if an error was already present.
Designed to be safe(ish) for use in out-of-memory scenarios; no additional allocations are made.
See imageflow_context_error_code
for a list of error codes.
Expectations
- Strings
message
andfunction_name
, andfilename
should be null-terminated UTF-8 strings. - The lifetime of
message
is expected to exceed the duration of this function call. - The lifetime of
filename
andfunction_name
(if provided), is expected to match or exceed the lifetime ofcontext
. - You may provide a null value for
filename
orfunction_name
, but for the love of puppies, don't provide a dangling or invalid pointer, that will segfault... a long time later.
Caveats
- You cannot raise a second error until the first has been cleared with
imageflow_context_clear_error
. You'll be ignored, as will futureimageflow_add_to_callstack
invocations. - Behavior is undefined if
context
is a null or invalid ptr; segfault likely. - Behavior is undefined if
message
is an invalid ptr; immediate segfault likely. - If you provide an error code of zero (why?!), a different error code will be provided.