-
Notifications
You must be signed in to change notification settings - Fork 524
Add error return codes to h3Index.c (part 1) #503
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
Conversation
// a pentagon always intersects 5 faces, a hexagon never intersects more | ||
// than 2 (but may only intersect 1) | ||
return H3_EXPORT(isPentagon)(h3) ? 5 : 2; | ||
*out = H3_EXPORT(isPentagon)(h3) ? 5 : 2; |
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.
Presumably later on this will also return an error message if the int64
isn't an H3 index?
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.
We could choose to add that check when being called by an application, yes. (Internally we might want to do that check once and then bypass it)
t_assert(numChildrenError == expectedError, "Expected error code"); | ||
if (expectedError != E_SUCCESS) { | ||
return; | ||
} |
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.
Does this imply that there are no errors we can test that won't be returned by cellToChildrenSize
? I.e. there are no errors in cellToChildren
that aren't in cellToChildrenSize
?
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.
cellToChildren
always returns E_SUCCESS
right now, so that is correct. It assumes its input has been validated by the size call.
Co-authored-by: Nick Rabinowitz <public@nickrabinowitz.com>
Co-authored-by: Nick Rabinowitz <public@nickrabinowitz.com>
Co-authored-by: Nick Rabinowitz <public@nickrabinowitz.com>
Applies the error return codes RFC to h3Index.c with the exception of some commonly used functions that return true/false.