-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
NodeJS version of osrm-routed #4604
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,22 +52,22 @@ Feature: Status messages | |
When I route I should get | ||
| request | status | message | | ||
| route/v1/driving/1,1;1,2 | 200 | | | ||
| route/v1/driving/-74697224,5.191564 | 400 | Query string malformed close to position 18 | | ||
| route/v1/driving/200,5.191564;44,5 | 400 | Invalid coordinate value. | | ||
| nonsense | 400 | URL string malformed close to position 9: "nse" | | ||
| nonsense/v1/driving/1,1;1,2 | 400 | Service nonsense not found! | | ||
| | 400 | URL string malformed close to position 1: "/" | | ||
| / | 400 | URL string malformed close to position 1: "//" | | ||
| ? | 400 | URL string malformed close to position 1: "/?" | | ||
| route/v1/driving | 400 | URL string malformed close to position 17: "ing" | | ||
| route/v1/driving/ | 400 | URL string malformed close to position 18: "ng/" | | ||
| route/v1/driving/1 | 400 | Query string malformed close to position 19 | | ||
| route/v1/driving/1,1 | 400 | Number of coordinates needs to be at least two. | | ||
| route/v1/driving/1,1,1 | 400 | Query string malformed close to position 21 | | ||
| route/v1/driving/x | 400 | Query string malformed close to position 18 | | ||
| route/v1/driving/x,y | 400 | Query string malformed close to position 18 | | ||
| route/v1/driving/1,1; | 400 | Query string malformed close to position 21 | | ||
| route/v1/driving/1,1;1 | 400 | Query string malformed close to position 23 | | ||
| route/v1/driving/1,1;1,1,1 | 400 | Query string malformed close to position 25 | | ||
| route/v1/driving/1,1;x | 400 | Query string malformed close to position 21 | | ||
| route/v1/driving/1,1;x,y | 400 | Query string malformed close to position 21 | | ||
| route/v1/driving/-74697224,5.191564 | 400 | At least two coordinates must be provided | | ||
| route/v1/driving/200,5.191564;44,5 | 400 | Lng/Lat coordinates must be within world bounds (-180 < lng < 180, -90 < lat < 90) | | ||
| nonsense | 404 | Path not found | | ||
| nonsense/v1/driving/1,1;1,2 | 404 | Path not found | | ||
| | 404 | Path not found | | ||
| / | 404 | Path not found | | ||
| ? | 404 | Path not found | | ||
| route/v1/driving | 404 | Path not found | | ||
| route/v1/driving/ | 404 | Path not found | | ||
| route/v1/driving/1 | 400 | At least two coordinates must be provided | | ||
| route/v1/driving/1,1 | 400 | At least two coordinates must be provided | | ||
| route/v1/driving/1,1,1 | 400 | At least two coordinates must be provided | | ||
| route/v1/driving/x | 400 | At least two coordinates must be provided | | ||
| route/v1/driving/x,y | 400 | At least two coordinates must be provided | | ||
| route/v1/driving/1,1; | 400 | Coordinates must be an array of (lon/lat) pairs | | ||
| route/v1/driving/1,1;1 | 400 | Coordinates must be an array of (lon/lat) pairs | | ||
| route/v1/driving/1,1;1,1,1 | 400 | Coordinates must be an array of (lon/lat) pairs | | ||
| route/v1/driving/1,1;x | 400 | Coordinates must be an array of (lon/lat) pairs | | ||
| route/v1/driving/1,1;x,y | 400 | Lng/Lat coordinates must be valid numbers | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the changes here? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ Feature: Basic trip planning | |
| waypoints | source | trips | | ||
| a,b,c,d,e,f,g,h,i,j,k,l | first | alkjihgfedcba | | ||
|
||
@todo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why disabling this test? |
||
Scenario: Testbot - Trip: Roundtrip FE waypoints (more than 10) | ||
Given the query options | ||
| source | last | | ||
|
@@ -370,4 +371,4 @@ Feature: Basic trip planning | |
When I plan a trip I should get | ||
| waypoints | trips | durations | geometry | | ||
| a,b,c,d | abcda | 7.6 | 1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009,1,1 | | ||
| d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 | | ||
| d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 | |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,23 @@ inline void ParseResult(const osrm::Status &result_status, osrm::json::Object &r | |
|
||
if (result_status == osrm::Status::Error) | ||
{ | ||
throw std::logic_error(code_iter->second.get<osrm::json::String>().value.c_str()); | ||
const auto message_iter = result.values.find("message"); | ||
if (message_iter != end_iter) | ||
{ | ||
// Concatenate the code: message so we don't lose details on errors | ||
const auto code = code_iter->second.get<osrm::json::String>().value.c_str(); | ||
const auto message = message_iter->second.get<osrm::json::String>().value.c_str(); | ||
auto buffer = | ||
std::make_unique<char[]>(std::strlen(code) + 2 + std::strlen(message) + 1); | ||
std::strcpy(buffer.get(), code); | ||
std::strcat(buffer.get(), ": "); | ||
std::strcat(buffer.get(), message); | ||
throw std::logic_error(buffer.get()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change the last couple of lines to const auto code = .. .value;
const auto message = .. .value;
// both are of type std::string now, see https://github.com/Project-OSRM/osrm-backend/blob/031ce72db1bdb724527096703c55741a7c7f572c/include/util/json_container.hpp#L81
throw std::logic_error{code + ": " + message} |
||
} | ||
else | ||
{ | ||
throw std::logic_error(code_iter->second.get<osrm::json::String>().value.c_str()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic_error should have a ctor taking a std::string; the c_str is not needed here |
||
} | ||
} | ||
|
||
result.values.erase(code_iter); | ||
|
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.
Why the change here? Is 10s no longer enough?