Skip to content

Generate the error taxonomy from the catalog's error contract - #16

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:gen/error-taxonomy
Sep 2, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:gen/error-taxonomy

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

MEOS raises through one mechanism — meos_error(errlevel, errcode, fmt, ...)
over the errorCode enum — and the catalog carries that enum verbatim as
objectModel.errors.codes, drift-gated against meos.h, with the meaning of
each code beside it. objectgen.py projects it: the MEOSErrorCodes enum,
one exception class per code, and the handler that turns the code MEOS reports
into the exception for it, each carrying the meaning MEOS states as its
documentation.

The taxonomy is complete by construction. A code the binding does not name
reaches the caller as MEOSInternalErrorException, and seven codes MEOS
raises take that path without a class of their own — MEOS_ERR_OUT_OF_MEMORY,
MEOS_ERR_FEATURE_NOT_SUPPORTED, MEOS_ERR_INDETERMINATE_COLLATION,
MEOS_ERR_SYNTAX_ERROR, MEOS_ERR_NULL_RESULT, MEOS_ERR_SQL_JSON_ERROR and
MEOS_ERR_INVALID_REGULAR_EXPRESSION — leaving a caller unable to tell an
unsupported feature from an internal fault. Deriving the set from the enum
gives each of them its own class.

The names are the ones the enum gives: MEOS_ERR_INVALID_ARG_VALUE reads
InvalidArgValue, and the acronym runs the catalog's own camelCase keeps —
WKB, MFJSON, GEOJSON, SQL, JSON — stay upper-case. The dispatch is one switch
expression over the code, which cannot fall through the arm it selects.

MEOS raises through one mechanism — `meos_error(errlevel, errcode, fmt, ...)`
over the `errorCode` enum — and the catalog carries that enum verbatim as
`objectModel.errors.codes`, drift-gated against `meos.h`, with the meaning of
each code beside it. `objectgen.py` projects it: the `MEOSErrorCodes` enum,
one exception class per code, and the handler that turns the code MEOS reports
into the exception for it, each carrying the meaning MEOS states as its
documentation.

The taxonomy is complete by construction. A code the binding does not name
reaches the caller as `MEOSInternalErrorException`, and seven codes MEOS
raises take that path without a class of their own — `MEOS_ERR_OUT_OF_MEMORY`,
`MEOS_ERR_FEATURE_NOT_SUPPORTED`, `MEOS_ERR_INDETERMINATE_COLLATION`,
`MEOS_ERR_SYNTAX_ERROR`, `MEOS_ERR_NULL_RESULT`, `MEOS_ERR_SQL_JSON_ERROR` and
`MEOS_ERR_INVALID_REGULAR_EXPRESSION` — leaving a caller unable to tell an
unsupported feature from an internal fault. Deriving the set from the enum
gives each of them its own class.

The names are the ones the enum gives: `MEOS_ERR_INVALID_ARG_VALUE` reads
`InvalidArgValue`, and the acronym runs the catalog's own camelCase keeps —
WKB, MFJSON, GEOJSON, SQL, JSON — stay upper-case. The dispatch is one switch
expression over the code, which cannot fall through the arm it selects.
@estebanzimanyi
estebanzimanyi merged commit 99a1126 into MobilityDB:main Sep 2, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the gen/error-taxonomy branch September 2, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant