When a query to MapBox returns 0 results the library isn't handling it gracefully.
To Reproduce
using nuget Geo.MapBox 1.1.1
Call Mapbox.GeocodingAsync with some query that returns no results.
Raw request:
- replace NONEXISTENTPLACE with any number of queries that have 0 results
- replace TOKEN with your access token
GET https://api.mapbox.com/geocoding/v5/mapbox.places/NONEXISTENTPLACE?autocomplete=true&fuzzyMatch=true&limit=1&routing=false&access_token=TOKEN HTTP/1.1
Host: api.mapbox.com
Raw response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8
Content-Length: 23
Connection: keep-alive
Date: Tue, 09 Aug 2022 00:01:06 GMT
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: x-rate-limit-interval,x-rate-limit-limit,x-rate-limit-remaining,x-rate-limit-reset
Cache-Control: max-age=604800
X-Rate-Limit-Limit: 600
X-Rate-Limit-Interval: 60
X-Rate-Limit-Reset: 1660003326
Last-Modified: Thu, 04 Aug 2022 19:09:01 GMT
Vary: Accept-Encoding
X-Cache: Error from cloudfront
Via: 1.1 5ece3a8d1e959c303daa9320e4fea502.cloudfront.net (CloudFront)
Age: 77
{"message":"Not Found"}
The library throws an exception with no exception data or inner exception.
Geo.MapBox.Models.Exceptions.MapBoxException
HResult=0x80131500
Message=The call to MapBox did not return a successful http status code. See the exception data for more information. See the inner exception for more information.
Source=Geo.Core
StackTrace:
at Geo.Core.ClientExecutor.<CallAsync>d__4`2.MoveNext()
at Geo.MapBox.Services.MapBoxGeocoding.<GeocodingAsync>d__9.MoveNext()
InnerException | null | System.Exception
Expected behavior
One of the following in order of preference (you should probably standardize the "no result" response across your other providers:
- A Empty set/object
- null
- An exception properly indicating no results found.
When a query to MapBox returns 0 results the library isn't handling it gracefully.
To Reproduce
using nuget Geo.MapBox 1.1.1
Call Mapbox.GeocodingAsync with some query that returns no results.
Raw request:
Raw response
The library throws an exception with no exception data or inner exception.
Expected behavior
One of the following in order of preference (you should probably standardize the "no result" response across your other providers: