bcgov / bcgov/ols-geocoder

In geocoder, add support for error messages in json

Open
#21 2 comments 0 reactions 0 assignees View on GitHub
api enhancement geocoder
Dominant language
Java
Stars
17
Forks
7
Avg merge
10h 2m
Merged PRs (30d)
15

Description

Currently, all error responses are in html format.

Change error handling so that:
1. A request for HTML or XHTML output returns an error in HTML format (as currently supported).
2. A request for KML output returns an error in KML format (as currently supported).
3. A request for json, geojson, CSV, or ShapeFile output returns an error in JSON format.

This is needed by JSON developers since JSON is the format they expect error objects to be in.

I propose we adopt the Google json error object as defined in:

https://google.github.io/styleguide/jsoncstyleguide.xml?showone=error#error
https://google.github.io/styleguide/jsoncstyleguide.xml?showone=error#error

So, for example, a request for a non-existent siteID and json output will return an HTTP Response code of 404 and the following JSON error object:

{
"apiVersion": "3.4",
"error": {
"code": 404,
"message": "Site Not Found",
}
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.