Skip to content

[fix] handle geoid errors with exceptions#28

Open
rsasaki0109 wants to merge 2 commits intomainfrom
fix/llh-converter-geoid-error-handling
Open

[fix] handle geoid errors with exceptions#28
rsasaki0109 wants to merge 2 commits intomainfrom
fix/llh-converter-geoid-error-handling

Conversation

@rsasaki0109
Copy link
Copy Markdown
Contributor

Summary

  • replace geoid error handling in GSIGEO2011 / JPGEO2024 from exit or silent NaN to std::runtime_error
  • let callers handle out-of-range geoid errors gracefully
  • add out-of-range tests for HeightConverter and LLHConverter

Testing

  • docker exec zealous_shamir bash -lc 'source /opt/map4api/ament/install/setup.bash && source /media/sasaki/aiueo/m4e_v2/dev_260202/install/setup.bash && cd /media/sasaki/aiueo/m4e_v2/dev_260126_m4e124 && colcon --log-base .review/m4e124/log build --packages-select llh_converter --build-base .review/m4e124/build --install-base .review/m4e124/install --cmake-args -DBUILD_TESTING=OFF && source .review/m4e124/build/llh_converter/devel/setup.bash && .review/m4e124/build/llh_converter/devel/lib/llh_converter/llh_test'\n\n## Note\n- existing JPGEO2024 value comparisons in llh_test still show the same mismatch in this environment; this PR only changes error handling paths.

@rsasaki0109 rsasaki0109 marked this pull request as ready for review March 30, 2026 06:48
Copy link
Copy Markdown

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

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

💡 To request another review, post a new comment with "/windsurf-review".

if (i1 < 0 || i2 >= row_size_ || j1 < 0 || j2 >= column_size_)
{
return std::numeric_limits<double>::quiet_NaN();
throwGeoidError("Input coordinates are outside the JPGEO2024 grid.");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For consistency with the other out-of-range error at line 156-158, consider including the actual coordinates in this error message as well to help with debugging.

Suggested change
throwGeoidError("Input coordinates are outside the JPGEO2024 grid.");
std::ostringstream oss;
oss << "Input coordinates are outside the JPGEO2024 grid: " << lat << ", " << lon;
throwGeoidError(oss.str());

if (f00 == -9999.0 || f10 == -9999.0 || f01 == -9999.0 || f11 == -9999.0)
{
return std::numeric_limits<double>::quiet_NaN();
throwGeoidError("Error: Not supported area");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The error message for unsupported areas could be more informative by including the coordinates that caused the error.

Suggested change
throwGeoidError("Error: Not supported area");
std::ostringstream oss;
oss << "Error: Not supported area at coordinates: " << lat << ", " << lon;
throwGeoidError(oss.str());

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.

1 participant