-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error returns to vertex functions #508
Conversation
src/h3lib/lib/vertex.c
Outdated
int cellIsPentagon = H3_EXPORT(isPentagon)(cell); | ||
int cellNumVerts = cellIsPentagon ? NUM_PENT_VERTS : NUM_HEX_VERTS; | ||
int res = H3_GET_RESOLUTION(cell); | ||
|
||
// Check for invalid vertexes | ||
if (vertexNum < 0 || vertexNum > cellNumVerts - 1) return H3_NULL; | ||
if (vertexNum < 0 || vertexNum > cellNumVerts - 1) return E_FAILED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an E_INVALID_INPUT
error we could use here? Do we need one? It would be really useful as a developer to understand whether the input was bad or the processing failed for a different reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps E_DOMAIN
, "Argument was outside of acceptable range (when a more specific error code is not available)"? This seems to most closely match what you mean by E_INVALID_INPUT
. We also have E_VERTEX_INVALID
if the vertex argument is invalid.
for (int i = 0; i < NUM_HEX_VERTS; i++) { | ||
vertexes[i] = H3_EXPORT(cellToVertex)(cell, i); | ||
if (i == 5 && isPent) { | ||
vertexes[i] = H3_NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Better to be explicit here
These functions are not documented on the website yet, so no documentation update here.