Skip to content
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

add distance limit in error message for 154 error code #3779

Merged
merged 8 commits into from
Oct 26, 2022

Conversation

nilsnolde
Copy link
Member

@nilsnolde nilsnolde commented Oct 3, 2022

fixes #3722

@jackrea07 & @reillywynn , in case you want to have a look. Since it's really annoying for the web app to not display this info, I did it quickly myself.

@kevinkreiser, regarding your comment here: #3752 (comment)

In fact, most other errors are already returning the server-side limit. Maybe it'd make sense to return both, the actual limit and the passed value, since the passed value is often not readily comprehensible (e.g. crow distance etc). I went without for now, since most existing errors also simply state the server limit.

@@ -109,7 +109,7 @@ edges_in_rings(const google::protobuf::RepeatedPtrField<valhalla::Ring>& rings_p
rings_length += bg::perimeter(ring_bg, Haversine());
}
if (rings_length > max_length) {
throw valhalla_exception_t(167, std::to_string(max_length));
Copy link
Member Author

Choose a reason for hiding this comment

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

meter precision is enough IMO:)

@@ -35,7 +35,8 @@ void check_distance(const google::protobuf::RepeatedPtrField<valhalla::Location>
}

if (path_distance > matrix_max_distance) {
throw valhalla_exception_t{154};
throw valhalla_exception_t{154, std::to_string(static_cast<size_t>(matrix_max_distance)) +
Copy link
Member Author

Choose a reason for hiding this comment

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

is there somewhere a function already that could replace std::to_string(static_cast<size_t>())? if not, would it make sense to add one to midgard.util.h or so?

@@ -1073,7 +1073,7 @@ valhalla_exception_t::valhalla_exception_t(unsigned code, const std::string& ext
*this = code_itr->second;
}
if (!extra.empty())
message += ":" + extra;
message += ": " + extra;
Copy link
Member Author

Choose a reason for hiding this comment

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

IMO it's nicer with a space after a colon

kevinkreiser
kevinkreiser previously approved these changes Oct 23, 2022
@nilsnolde
Copy link
Member Author

can you re-approve @kevinkreiser ?

@kevinkreiser kevinkreiser merged commit 1e2d273 into master Oct 26, 2022
@kevinkreiser kevinkreiser deleted the nn-add-distance-msg branch October 26, 2022 10:26
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.

Show distance limit in error message
2 participants