I have spent all day on this, so hoping one of you pros can give me a suggestion here.
I have a scheduled task which makes a call to the google drive API. For whatever reason the google drive API throws an error from time to time. If I rerun the same API call it normally works the second time around due to the request being cached on the google end).
I would like to catch the error, or ignore it and do a test afterwards on the returned object, but despite trying to catch errors, set custom exception handlers etc the scheduled task always insists on failing.
Here is the code that occasionally returns a json file with error code:
$getScorm = $service->files->get($scorm->id, array('alt' => 'media'));
Scheduled task failed: BLC Module Synchronisation (block_scorm_package\task\cron_task),{
"error": {
"code": 500,
"message": null
}
}
Any suggestions on how I can stop the whole task from failing?
Many thanks,
Oliver