pit

Runtime and Errors

Back to index

OpenPitOutError

Error out-pointer used by fallible FFI calls.

typedef OpenPitSharedString ** OpenPitOutError;

OpenPitParamErrorCode

Parameter error code transported through FFI.

typedef uint32_t OpenPitParamErrorCode;
/**
 * Error code is not specified.
 */
#define OpenPitParamErrorCode_Unspecified ((OpenPitParamErrorCode) 0)
/**
 * Value must be non-negative.
 */
#define OpenPitParamErrorCode_Negative ((OpenPitParamErrorCode) 1)
/**
 * Division by zero.
 */
#define OpenPitParamErrorCode_DivisionByZero ((OpenPitParamErrorCode) 2)
/**
 * Arithmetic overflow.
 */
#define OpenPitParamErrorCode_Overflow ((OpenPitParamErrorCode) 3)
/**
 * Arithmetic underflow.
 */
#define OpenPitParamErrorCode_Underflow ((OpenPitParamErrorCode) 4)
/**
 * Invalid float value.
 */
#define OpenPitParamErrorCode_InvalidFloat ((OpenPitParamErrorCode) 5)
/**
 * Invalid textual format.
 */
#define OpenPitParamErrorCode_InvalidFormat ((OpenPitParamErrorCode) 6)
/**
 * Invalid price value.
 */
#define OpenPitParamErrorCode_InvalidPrice ((OpenPitParamErrorCode) 7)
/**
 * Invalid leverage value.
 */
#define OpenPitParamErrorCode_InvalidLeverage ((OpenPitParamErrorCode) 8)
/**
 * Asset identifier is empty.
 */
#define OpenPitParamErrorCode_AssetEmpty ((OpenPitParamErrorCode) 9)
/**
 * Account identifier string is empty.
 */
#define OpenPitParamErrorCode_AccountIdEmpty ((OpenPitParamErrorCode) 10)
/**
 * Catch-all code for unknown cases.
 */
#define OpenPitParamErrorCode_Other ((OpenPitParamErrorCode) 4294967295)

OpenPitParamError

Caller-owned parameter error container.

typedef struct OpenPitParamError {
    OpenPitParamErrorCode code;
    OpenPitSharedString * message;
} OpenPitParamError;

OpenPitOutParamError

Parameter error out-pointer used by fallible param FFI calls.

typedef OpenPitParamError ** OpenPitOutParamError;

openpit_destroy_param_error

Releases a caller-owned parameter error container.

Safety

handle must be either null or a pointer returned by this library through OpenPitOutParamError. The handle must be destroyed at most once.

void openpit_destroy_param_error(
    OpenPitParamError * handle
);

openpit_get_runtime_version

Returns the OpenPit runtime version string.

This function never fails.

The returned view is read-only, never null, and remains valid for the entire process lifetime. The caller must not release it.

OpenPitStringView openpit_get_runtime_version(void);