15#include "tempoch_ffi.h"
71inline void check_status(tempoch_status_t status,
const char* operation) {
72 if (status == TEMPOCH_STATUS_T_OK)
return;
74 std::string msg = std::string(operation) +
" failed: ";
76 case TEMPOCH_STATUS_T_NULL_POINTER:
78 case TEMPOCH_STATUS_T_UTC_CONVERSION_FAILED:
80 case TEMPOCH_STATUS_T_INVALID_PERIOD:
82 case TEMPOCH_STATUS_T_NO_INTERSECTION:
85 throw TempochException(msg +
"unknown error (" + std::to_string(status) +
")");
The period is invalid (start > end).
InvalidPeriodError(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)
Base exception for all tempoch errors.
TempochException(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.