agrc / masquerade

Disguise UGRC's Web API endpoints as an Esri locator service.
https://github.com/agrc/masquerade#readme
MIT License
1 stars 0 forks source link

Handle 404s from the web api #98

Closed stdavis closed 1 year ago

stdavis commented 1 year ago

This applies to the /findAddressCandidates endpoint and only to addresses with a zone...

The Esri locator service returns an empty candidates array and a 200 status when there are no matches...

{
 "spatialReference": {
  "wkid": 26912,
  "latestWkid": 26912
 },
 "candidates": [

 ]
}

Our web API returns an error message with a 404 status...

{
  "status": 404,
  "message": "No address candidates found with a score of 70 or better."
}

Currently, masquerade is set to throw exceptions if the requests to our web API return a non-200-series status code which results in a 500 response. This needs to be updated to handle 404s and return the appropriate 200 and empty candidates array.