When I go over my API limit for opencage it throws: "Error: Response status code is 402" from \lib\httpadapter\httpadapter.js:58:25
This is acceptable, but there is no way to catch it. When I go over the Google API limit, the error it is thrown in a catchable manner and I see output: "Error: Error: Status is OVER_QUERY_LIMIT. You have exceeded your rate-limit for this API."
Below is an example to reproduce these two cases. Google is how it should work, while opencage I believe has a bug.
import 'babel-polyfill';
import co from 'co';
import NodeGeocoder from 'node-geocoder';
const geocoder = NodeGeocoder('opencage', 'https', {apiKey: 'MYAPYKEYHERE'});
//const geocoder = NodeGeocoder('google');
co(function *() {
for (let i = 0; i < 5000; ++i) {
try {
const res = yield geocoder.reverse({lat: '40.71', lon: '-74.0'});
console.log(res)
} catch (err) {
console.log('Error: ' + err);
}
}
});
Hi,
When I go over my API limit for opencage it throws: "Error: Response status code is 402" from
\lib\httpadapter\httpadapter.js:58:25
This is acceptable, but there is no way to catch it. When I go over the Google API limit, the error it is thrown in a catchable manner and I see output: "Error: Error: Status is OVER_QUERY_LIMIT. You have exceeded your rate-limit for this API."
Below is an example to reproduce these two cases. Google is how it should work, while opencage I believe has a bug.