Skip to content

Conversation

@isaacbrodsky
Copy link
Collaborator

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?

@coveralls
Copy link

coveralls commented Aug 24, 2021

Coverage Status

Coverage increased (+0.03%) to 98.685% when pulling 0c60d59 on isaacbrodsky:error-returns-grid-path into 2801fca on uber:master.

originBaseCell >= NUM_BASE_CELLS) {
// Base cells less than zero can not be represented in an index
return 1;
return E_CELL_INVALID;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing any tests for this specific error, could we add?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, not seeing specific tests for this

// invalid.
if (_h3LeadingNonZeroDigit(*out) == K_AXES_DIGIT) {
return 4;
return E_PENTAGON;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this and the errors above had different codes previously, but now both get E_PENTAGON?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@isaacbrodsky isaacbrodsky force-pushed the error-returns-grid-path branch from 00749d8 to a502769 Compare September 3, 2021 01:54
@isaacbrodsky isaacbrodsky merged commit 0302b93 into uber:master Sep 3, 2021
@isaacbrodsky isaacbrodsky deleted the error-returns-grid-path branch September 3, 2021 02:23
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.

4 participants