Hi. I’m trying to use GBIF API on a node.js project to retrieve occurrence information about some species, but in random cases it returns me a JSON with an exception from java. Am I using it wrong? is it a bug or what? Thank you.
Code:
private async getDataFromGbifAPI(
offset: number,
limit: number,
binomialName: string,
) {
try {
const {
data: { results },
} = await GBIF_OCCURENCE_API.get('/search', {
params: {
scientificName: binomialName,
offset,
limit,
},
timeout: 0,
});
const filteredResults = [];
results.forEach((result: IGbifOccurrence) => {
...
});
return filteredResults;
} catch {
console.log(
'problem on specie with name:',
binomialName,
'at offset',
offset,
);
return [];
}
}
It shows on the console:
problem on specie with name: Eichhornia crassipes at offset 6750
problem on specie with name: Eichhornia crassipes at offset 26000
The output which contains the exception: