-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Library name and version
Azure Maps Routing API Version: 1.0
Describe the bug
When submitting a Post Route Matrix Request I encountered a deserialization issue with the RouteMatrixResult API when a distance to one of the destinations cannot be resolved. Specifically, the API returns a serialized RouteMatrixResult containing an array of RouteMatrixes. Each RouteMatrix holds a RouteMatrixResultResponse, which in turn contains a RouteLegSummary.
However, when the distance to a destination cannot be resolved, the response field in the RouteMatrixResultResponse is returned as an error string instead of a null value for the RouteMatrixResultResponse object. This causes a deserialization error on the client side, which currently requires manual handling.
Example json:
{
"formatVersion": "0.0.1",
"matrix": [
[
{
"statusCode": 400,
"response": "Engine error while executing route request: MAP_MATCHING_FAILURE: Destination (1, 13.5471)",
"detailedError": {
"message": "Engine error while executing route request: MAP_MATCHING_FAILURE: Destination (1, 13.5471)",
"code": "MAP_MATCHING_FAILURE"
}
},
{
"statusCode": 200,
"response": {
"routeSummary": {
"lengthInMeters": 264939,
"travelTimeInSeconds": 10394,
"trafficDelayInSeconds": 191,
"trafficLengthInMeters": 16648,
"departureTime": "2024-08-21T09:31:41+02:00",
"arrivalTime": "2024-08-21T12:24:55+02:00"
}
}
},
{
"statusCode": 200,
"response": {
"routeSummary": {
"lengthInMeters": 305985,
"travelTimeInSeconds": 11207,
"trafficDelayInSeconds": 191,
"trafficLengthInMeters": 16648,
"departureTime": "2024-08-21T09:31:41+02:00",
"arrivalTime": "2024-08-21T12:38:28+02:00"
}
}
}
]
]
}
n the example above, the first entry in the matrix array returns an error string under the response field, which causes a deserialization failure on the client side.
Expected behavior
The response field should return a null value or an appropriately structured error object instead of a plain error string when a distance cannot be resolved. This would prevent deserialization errors and allow the client to handle errors more gracefully.
Actual behavior
Deserialization fails
Reproduction Steps
Steps to Reproduce:
- Make a request to the RouteMatrix API with a destination that cannot be resolved.
- Observe the response field in the RouteMatrixResultResponse for the destination.
- Attempt to deserialize the response into the expected object model.
Environment
.NET6, VS Version 17.10.5