Reputation: 52
I have a script to call the GeoTab API to retrieve data for some vehicles. The script is failing.
async function getFuelTypeDevices(){
fuelTypeDevices = await api.call("Get",{
"typeName":"Device",
"search":{
"groups": fuelType,
"fromDate":new Date().toISOString(),
},},
function(results){
for (var x =0; x < results.length; x++){
fuelTypeDevices[x] = results[x].id;
}});}
I get the following error:
/Users/basillatif/Desktop/CALSTART.nosync/FritoLay_Main/FritolayScripts/node_modules/mg-api-js/dist/webpack:/GeotabApi/lib/GeotabApi.js:71
throw new Error(`If callbackSuccess is supplied so must callbackError`);
I need to catch the callbackError. Once I catch the error in this function I get an error further down in my code saying that fuelTypeDevices is undefined. What is the best way to catch the callback error?
Upvotes: 0
Views: 45
Reputation: 52
I was able to solve this issue and call the API with the same code by downgrading the version of the Geotab node package to [email protected]
Upvotes: 0