-
Notifications
You must be signed in to change notification settings - Fork 322
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
Handle routing engine http statuses #1083
Comments
Not sure what you mean here since this is already what's happening internally in the two links you shared. The way this translates to the output is that whenever we catch such an error, the status is set accordingly, see https://github.com/VROOM-Project/vroom/blob/master/docs/API.md#code. So on top of the (short) message you get, you also already get an indication of the origin of the error based on the |
@jcoupey Ok, I'll show you the concrete cases. Case 1 - Confusing messageRouting engine configuration: ors:
driving-car:
host: 'ors-app' # There is only host without the standard base path /ors/v2
port: '8080' Request the matrix to Response body contains html page. Status is <!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2... Vroom result: { "code": 3, "error": "Missing durations." } The problem is that the Case 2 - Segmentation faultRouting engine configuration: ors:
driving-car:
host: 'ors-app/ors/v3' # There is a typo in the version. It must be v2.
port: '8080' Request the matrix to Response body is in json format. Status is {
"timestamp": "...",
"status": 404,
"error": "Not Found",
"path": "/ors/v3/matrix/driving-car"
} Vroom process crashed with Vroom API response: { "code": 1, "error": "Internal error" } I don't think the process should crash because of the wrong path. It would be good to wrap the routing engine error into something more meaningful. |
Thanks for elaborating on this. I indeed overlooked the initial problem, which is that we should have an additional check to catch the error earlier. I see two ways of doing this:
The first option would require to get the status from asio, probably possible but I never really looked at that. The second option could be easy to setup: currently we only check for json parsing errors in debug mode, see vroom/src/routing/http_wrapper.cpp Lines 144 to 148 in 1fd711b
RoutingException with a somewhat more explicit message.
|
On the second case: I don't have an ORS setup to reproduce right now but I'm a bit surprised that you don't get a |
As I understand |
Not Found ORS error violates their service routing error convention. This is a web framework error and not a matrix service error. The {
"timestamp": "...",
"status": 404,
"error": "Not Found",
"path": "/ors/v3/matrix/driving-car"
} vroom/src/routing/ors_wrapper.cpp Lines 64 to 71 in 176f57a
|
So we should check for the |
Hello! I migrated vroom from
v1.13.0
tov1.14.0
and got aMissing durations
error. Then I discovered that the problem is connected to the requirement of adding the postfixors/v2
to thehost
setting. But the main problem is that vroom doesn't handle any HTTP status codes, so it's hard to debug such errors. Perhaps a good option would be to throw aRoutingException
?The status just drops
vroom/src/routing/http_wrapper.cpp
Lines 123 to 126 in 1fd711b
and I received an error related to the request body
vroom/src/routing/http_wrapper.cpp
Lines 161 to 164 in 1fd711b
The text was updated successfully, but these errors were encountered: