Generate the error taxonomy from the catalog's error contract - #16
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MEOS raises through one mechanism —
meos_error(errlevel, errcode, fmt, ...)over the
errorCodeenum — and the catalog carries that enum verbatim asobjectModel.errors.codes, drift-gated againstmeos.h, with the meaning ofeach code beside it.
objectgen.pyprojects it: theMEOSErrorCodesenum,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 MEOSraises 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_ERRORandMEOS_ERR_INVALID_REGULAR_EXPRESSION— leaving a caller unable to tell anunsupported 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_VALUEreadsInvalidArgValue, 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.