|
Lance C/C++ Bindings
C ABI and header-only C++ RAII wrappers for the Lance columnar data format
|
Error codes and the thread-local error accessors. More...
#include "lance/attributes.h"Go to the source code of this file.
Enumerations | |
| enum | LanceErrorCode { LANCE_OK = 0 , LANCE_ERR_INVALID_ARGUMENT = 1 , LANCE_ERR_IO = 2 , LANCE_ERR_NOT_FOUND = 3 , LANCE_ERR_DATASET_ALREADY_EXISTS = 4 , LANCE_ERR_INDEX = 5 , LANCE_ERR_INTERNAL = 6 , LANCE_ERR_NOT_SUPPORTED = 7 , LANCE_ERR_COMMIT_CONFLICT = 8 , LANCE_ERR_PANIC = 9 } |
Functions | |
| LANCE_API LanceErrorCode | lance_last_error_code (void) |
| LANCE_NODISCARD LANCE_API const char * | lance_last_error_message (void) |
| LANCE_API void | lance_free_string (const char *s) |
Error codes and the thread-local error accessors.
Definition in file error.h.
| enum LanceErrorCode |
| LANCE_API void lance_free_string | ( | const char * | s | ) |
Free a string returned by lance_last_error_message().
| LANCE_API LanceErrorCode lance_last_error_code | ( | void | ) |
Panic handling (issue lance-format/lance-c#61).
A panic raised inside Lance/Arrow code is caught at the FFI boundary and reported as LANCE_ERR_PANIC through the usual thread-local error channel (lance_last_error_code / lance_last_error_message) instead of unwinding into the host. After a panic:
Honest limits: a double panic, a panic in a destructor while unwinding, a stack overflow, or an allocation failure still aborts the process. A panic caught inside a close/free call (lance_*_close, lance_batch_free, lance_free_string, lance_scanner_async_stream_free, or the release callback of an exported ArrowArrayStream) is logged and the remainder of the value may leak — close is best-effort by design. Post-panic process state is best-effort: hosts should fail the in-flight query rather than retry a poisoned handle.
Callbacks passed INTO the library (LanceCallback, LanceWaker, and LanceScanStatisticsCallback, LanceTrackedFilesProgressCallback and LanceTrackedFilesProgressRelease) are the reverse direction and are NOT covered by this contract: their ABI is non-unwinding, so a callback that throws or unwinds can abort the host process before the library can contain it. Callbacks must return normally.
This contract requires Rust's panic = "unwind" strategy. The crate rejects panic = "abort" builds at compile time because catch_unwind cannot provide this API contract in such a build. Return the error code from the last failed operation on this thread.
| LANCE_NODISCARD LANCE_API const char * lance_last_error_message | ( | void | ) |
Return the error message. Caller must free with lance_free_string().