Skip to content

Commit

Permalink
refactor!: use negative values for errors in the C API
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Oct 1, 2024
1 parent 80b18d2 commit 2a06f6f
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/machine-c-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,30 @@ typedef enum cm_pma_constant {

/// \brief Error codes returned from the C API.
typedef enum cm_error {
CM_ERROR_OK,
CM_ERROR_INVALID_ARGUMENT,
CM_ERROR_DOMAIN_ERROR,
CM_ERROR_LENGTH_ERROR,
CM_ERROR_OUT_OF_RANGE,
CM_ERROR_LOGIC_ERROR,
CM_ERROR_RUNTIME_ERROR,
CM_ERROR_RANGE_ERROR,
CM_ERROR_OVERFLOW_ERROR,
CM_ERROR_UNDERFLOW_ERROR,
CM_ERROR_REGEX_ERROR,
CM_ERROR_SYSTEM_ERROR,
CM_ERROR_BAD_TYPEID,
CM_ERROR_BAD_CAST,
CM_ERROR_BAD_ANY_CAST,
CM_ERROR_BAD_OPTIONAL_ACCESS,
CM_ERROR_BAD_WEAK_PTR,
CM_ERROR_BAD_FUNCTION_CALL,
CM_ERROR_BAD_ALLOC,
CM_ERROR_BAD_ARRAY_NEW_LENGTH,
CM_ERROR_BAD_EXCEPTION,
CM_ERROR_BAD_VARIANT_ACCESS,
CM_ERROR_EXCEPTION,
CM_ERROR_UNKNOWN,
CM_ERROR_OK = 0,
CM_ERROR_INVALID_ARGUMENT = -1,
CM_ERROR_DOMAIN_ERROR = -2,
CM_ERROR_LENGTH_ERROR = -3,
CM_ERROR_OUT_OF_RANGE = -4,
CM_ERROR_LOGIC_ERROR = -5,
CM_ERROR_RUNTIME_ERROR = -6,
CM_ERROR_RANGE_ERROR = -7,
CM_ERROR_OVERFLOW_ERROR = -8,
CM_ERROR_UNDERFLOW_ERROR = -9,
CM_ERROR_REGEX_ERROR = -10,
CM_ERROR_SYSTEM_ERROR = -11,
CM_ERROR_BAD_TYPEID = -12,
CM_ERROR_BAD_CAST = -13,
CM_ERROR_BAD_ANY_CAST = -14,
CM_ERROR_BAD_OPTIONAL_ACCESS = -15,
CM_ERROR_BAD_WEAK_PTR = -16,
CM_ERROR_BAD_FUNCTION_CALL = -17,
CM_ERROR_BAD_ALLOC = -18,
CM_ERROR_BAD_ARRAY_NEW_LENGTH = -19,
CM_ERROR_BAD_EXCEPTION = -20,
CM_ERROR_BAD_VARIANT_ACCESS = -21,
CM_ERROR_EXCEPTION = -22,
CM_ERROR_UNKNOWN = -23,
} cm_error;

/// \brief Reasons for a machine run interruption.
Expand Down

0 comments on commit 2a06f6f

Please sign in to comment.