Add error returns to gridPath/gridDistance functions#507
Merged
isaacbrodsky merged 8 commits intouber:masterfrom Sep 3, 2021
Merged
Add error returns to gridPath/gridDistance functions#507isaacbrodsky merged 8 commits intouber:masterfrom
isaacbrodsky merged 8 commits intouber:masterfrom
Conversation
dfellis
approved these changes
Aug 26, 2021
nrabinowitz
approved these changes
Aug 26, 2021
| originBaseCell >= NUM_BASE_CELLS) { | ||
| // Base cells less than zero can not be represented in an index | ||
| return 1; | ||
| return E_CELL_INVALID; |
Collaborator
There was a problem hiding this comment.
Not seeing any tests for this specific error, could we add?
Collaborator
Author
There was a problem hiding this comment.
Changed/added tests for specific error codes
| originBaseCell >= NUM_BASE_CELLS) { | ||
| // Base cells less than zero can not be represented in an index | ||
| return 1; | ||
| return E_CELL_INVALID; |
Collaborator
There was a problem hiding this comment.
Ditto, not seeing specific tests for this
| // invalid. | ||
| if (_h3LeadingNonZeroDigit(*out) == K_AXES_DIGIT) { | ||
| return 4; | ||
| return E_PENTAGON; |
Collaborator
There was a problem hiding this comment.
Curious why this and the errors above had different codes previously, but now both get E_PENTAGON?
Collaborator
Author
There was a problem hiding this comment.
These codes were arbitrary and just indicated different return sites - they didn't really have any smenatic meaning. In h3-java, 3, 4, and 5 were all translated to the same message (essentially E_PENTAGON)
00749d8 to
a502769
Compare
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.
Adds consistent error returns to the gridPathCells, gridDistance, and localIj series of functions. These functions mostly already had error codes but they were not consistent with
H3Error.Changes to traversal.mdx might need to be rebased with #505.
I'm moving functions to pass int64_t when it refers to a number of cells to be consistent with
getNumCells. Would it make sense to introduce a typedef (H3NumCells?H3NumIndexes?) to avoid confusion about which type to use? Or just standardize on int64_t and let ourselves get used to that?