agolgeocoder crashing application when using invalid client and secret key instead of throwing exception
in the file node-geocoder/lib/geocoder/agolgeocoder.js:86:21,
when agolgeocoder returns an error, the variable result receives a json object format, as the example below:
{ error: { code: 400, error: 'invalid_client_id', error_description: 'Invalid client_id', message: 'Invalid client_id', details: [] } }
but, the code tries to parse the object to json again, resulting on the following error:
`
/app/node_modules/bluebird/js/release/async.js:49
fn = function () { throw arg; };
^
SyntaxError: "[object Object]" is not valid JSON
at JSON.parse (
a possible fix would be parse the response to json only if it's of the type string, something like:
if (typeof result === 'string') { result = JSON.parse(result); }
what do you think?
Yes it will be better, do you think you could come with a PR to fix that?
I can verify this error, but it appears to occur with even valid credentials as the token results are already parsed.
Note: access token in screen cap has already been invalidated.
Ok @nchaulet , I will create a new PR