15#include "tempoch_ffi.h"
139inline void check_status(tempoch_status_t status,
const char *operation) {
140 if (status == TEMPOCH_STATUS_T_OK)
143 std::string msg = std::string(operation) +
" failed: ";
145 case TEMPOCH_STATUS_T_NULL_POINTER:
147 case TEMPOCH_STATUS_T_UTC_CONVERSION_FAILED:
149 case TEMPOCH_STATUS_T_INVALID_PERIOD:
151 case TEMPOCH_STATUS_T_NO_INTERSECTION:
153 case TEMPOCH_STATUS_T_INVALID_SCALE_ID:
155 case TEMPOCH_STATUS_T_INVALID_DURATION_UNIT:
157 case TEMPOCH_STATUS_T_CONVERSION_FAILED:
159 case TEMPOCH_STATUS_T_INVALID_FORMAT_ID:
161 case TEMPOCH_STATUS_T_INTERNAL_PANIC:
163 case TEMPOCH_STATUS_T_UT1_HORIZON_EXCEEDED:
165 case TEMPOCH_STATUS_T_PERIOD_LIST_UNSORTED:
167 case TEMPOCH_STATUS_T_PERIOD_LIST_OVERLAPPING:
170 throw TempochException(msg +
"unknown error (" + std::to_string(status) +
")");
A generic scale/format conversion failed.
ConversionFailedError(const std::string &msg)
Rust caught a panic before unwinding across the FFI boundary.
InternalPanicError(const std::string &msg)
The supplied quantity does not represent a time duration.
InvalidDurationUnitError(const std::string &msg)
The period is invalid (start > end).
InvalidPeriodError(const std::string &msg)
The supplied raw scale identifier is invalid.
InvalidScaleIdError(const std::string &msg)
The two periods do not intersect.
NoIntersectionError(const std::string &msg)
A required output pointer was null.
NullPointerError(const std::string &msg)
The period list contains overlapping intervals.
PeriodListOverlappingError(const std::string &msg)
The period list is not sorted by start time.
PeriodListUnsortedError(const std::string &msg)
Base exception for all tempoch errors.
TempochException(const std::string &msg)
A UT1 conversion requested data beyond the compiled ΔT/EOP horizon.
Ut1HorizonExceededError(const std::string &msg)
UTC conversion failed (date out of range or invalid).
UtcConversionError(const std::string &msg)
void check_status(tempoch_status_t status, const char *operation)
Check a tempoch_status_t and throw the appropriate exception on error.