Error handling

Error handling

Hi,
I have built an error handler function for my google api call. However I’m struggling to find an elegant way to restart the original workflow or function upon refreshing the access token.

workflow: run function “api call” (for example read a file on google drive)

function api call: calls google api and upon response = error, calls errorhandler.

function errorhandler: deal with the error. If the error is ‘token expired’, call function “refreshtoken”. 

Function refreshtoken: refreshes google access token

How do I re-call the original function upon successfully refreshing the token?? The errorhandler and refreshtoken functions may be called from any function that calls the google api....