Cookies info

This website uses Google cookies to analyse traffic. Information about your use of our site is shared with Google for that purpose. See details.

Errors

Errors

Some AmanithSVG functions may encounter errors. Unless otherwise specified, any value returned from a function following an error is undefined. An error condition within an AmanithSVG function must never result in process termination, with the exception of illegal memory accesses taking place within functions that accept an application provided pointer.

All AmanithSVG functions may signal SVGT_OUT_OF_MEMORY_ERROR. Such an error may occur midway through the execution of an AmanithSVG function, in which case the function may have caused changes to the state of AmanithSVG (or to drawing structures) prior to failure. When an AmanithSVG function encounters an error other than a SVGT_OUT_OF_MEMORY_ERROR, the context state is not modified and no drawing takes place.

All possible error codes are defined by the enumeration type SVGTErrorCode.

Error codeNotes
SVGT_NO_ERRORThe operation was completed successfully (defined as 0)
SVGT_NOT_INITIALIZED_ERRORIt indicates that the library has not previously been initialized through the svgtInit function
SVGT_BAD_HANDLE_ERRORReturned when one or more invalid document/surface handles are passed to AmanithSVG functions
SVGT_ILLEGAL_ARGUMENT_ERRORReturned when one or more illegal arguments are passed to AmanithSVG functions
SVGT_OUT_OF_MEMORY_ERRORAll AmanithSVG functions may signal an “out of memory” error
SVGT_PARSER_ERRORReturned when an invalid or malformed XML is passed to the svgtDocCreate
SVGT_INVALID_SVG_ERRORReturned when a document fragment is technically in error (e.g. if an element has an attribute or property value which is not permissible according to SVG specifications or if the outermost element is not an <svg> element)
SVGT_STILL_PACKING_ERRORReturned when a current packing task is still open, and so the operation (e.g. svgtPackingBinInfo) is not allowed
SVGT_NOT_PACKING_ERRORReturned when there isn’t a currently open packing task, and so the operation (e.g. svgtPackingAdd) is not allowed
SVGT_INVALID_RESOURCE_ERRORThe specified resource, via svgtResourceSet, is not valid or it does not match the given resource type
/*
    Retrieve the error code generated by the last called API function.
    The last-error code is maintained on a per-thread basis. Multiple threads
    do not overwrite each other's last-error code.

    Not all functions set the last-error code; however those who do, they set
    the last-error code both in the event of an error and of success.
    So svgtGetLastError should be called immediately when an API function's
    return value indicates that such a call will return useful data.

    If the API function is not documented to set the last-error code, the value
    returned by this function is simply the most recent last-error code to have
    been set.
*/
SVGTErrorCode svgtGetLastError(void);