Skip to content

Add error returns to vertex functions#508

Merged
isaacbrodsky merged 2 commits into
uber:masterfrom
isaacbrodsky:error-returns-vertex
Sep 2, 2021
Merged

Add error returns to vertex functions#508
isaacbrodsky merged 2 commits into
uber:masterfrom
isaacbrodsky:error-returns-vertex

Conversation

@isaacbrodsky

Copy link
Copy Markdown
Collaborator

These functions are not documented on the website yet, so no documentation update here.

@coveralls

coveralls commented Aug 26, 2021

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.05%) to 98.651% when pulling 6b36d6f on isaacbrodsky:error-returns-vertex into 897f9ca on uber:master.

Comment thread src/h3lib/lib/vertex.c Outdated

// Check for invalid vertexes
if (vertexNum < 0 || vertexNum > cellNumVerts - 1) return H3_NULL;
if (vertexNum < 0 || vertexNum > cellNumVerts - 1) return E_FAILED;

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Collaborator Author

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.

Comment thread src/h3lib/lib/vertex.c
for (int i = 0; i < NUM_HEX_VERTS; i++) {
vertexes[i] = H3_EXPORT(cellToVertex)(cell, i);
if (i == 5 && isPent) {
vertexes[i] = H3_NULL;

Copy link
Copy Markdown
Collaborator

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

@isaacbrodsky
isaacbrodsky merged commit 2801fca into uber:master Sep 2, 2021
@isaacbrodsky
isaacbrodsky deleted the error-returns-vertex branch September 2, 2021 19:24
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.

5 participants