17#define RR_RETURN_NOT_OK(status_expr) \
19 const rerun::Error _status_ = status_expr; \
20 if (_status_.is_err()) { \
37 _CategoryArgument = 0x0000'0010,
38 UnexpectedNullArgument,
39 InvalidStringArgument,
41 InvalidRecordingStreamHandle,
43 InvalidComponentTypeHandle,
45 InvalidTensorDimension,
47 InvalidServerUrl = 0x0000'0001a,
52 _CategoryRecordingStream = 0x0000'0100,
53 RecordingStreamRuntimeFailure,
54 RecordingStreamCreationFailure,
55 RecordingStreamSaveFailure,
56 RecordingStreamStdoutFailure,
57 RecordingStreamSpawnFailure,
58 RecordingStreamChunkValidationFailure,
59 RecordingStreamServeGrpcFailure,
60 RecordingStreamFlushTimeout,
61 RecordingStreamFlushFailure,
64 _CategoryArrow = 0x0000'1000,
65 ArrowFfiSchemaImportError,
66 ArrowFfiArrayImportError,
69 _CategoryUtilities = 0x0001'0000,
73 _CategoryFileIO = 0x0010'0000,
77 _CategoryArrowCppStatus = 0x1000'0000,
78 ArrowStatusCode_KeyError,
79 ArrowStatusCode_TypeError,
80 ArrowStatusCode_Invalid,
81 ArrowStatusCode_IOError,
82 ArrowStatusCode_CapacityError,
83 ArrowStatusCode_IndexError,
84 ArrowStatusCode_Cancelled,
85 ArrowStatusCode_UnknownError,
86 ArrowStatusCode_NotImplemented,
87 ArrowStatusCode_SerializationError,
88 ArrowStatusCode_RError,
89 ArrowStatusCode_CodeGenError,
90 ArrowStatusCode_ExpressionValidationError,
91 ArrowStatusCode_ExecutionError,
92 ArrowStatusCode_AlreadyExists,
94 Unknown = 0xFFFF'FFFF,
115 : code(_code), description(std::move(_description)) {}
135 return code == ErrorCode::Ok;
140 return code != ErrorCode::Ok;
175#ifdef __cpp_exceptions
177 throw std::runtime_error(description);
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:103
void handle() const
Handle this error based on the set log handler.
bool is_err() const
Returns true if the code is not Ok.
Definition error.hpp:139
bool is_ok() const
Returns true if the code is Ok.
Definition error.hpp:134
static Error ok()
Creates a new error set to ok.
Definition error.hpp:124
static void set_log_handler(StatusLogHandler handler, void *userdata=nullptr)
Sets global log handler called for handle.
void throw_on_failure() const
Throws a std::runtime_error if the status is not Ok.
Definition error.hpp:174
Error(const rr_error &status)
Construct from a C status object.
bool operator==(const Error &other) const
Compare two errors for equality. Requires the description to match.
Definition error.hpp:129
ErrorCode code
Result code for the given operation.
Definition error.hpp:106
Error(const arrow::Status &status)
Construct from an arrow status.
void exit_on_failure() const
Calls the handle method and then exits the application with code 1 if the error is not Ok.
std::string description
Human readable description of the error.
Definition error.hpp:109
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
void(*)(const class Error &status, void *userdata) StatusLogHandler
Callback function type for log handlers.
Definition error.hpp:98
ErrorCode
Status codes returned by the SDK as part of Status.
Definition error.hpp:30