Is there a way to catch programmatically the invalid_grant error (when the scope is not defined correctly?)

Hi everyone,

We are about to change the app’s scope and to add “ACT_AS_USER”. In order to support backwards compatibility with the instances that will not get the latest copy of the app description, I would like to catch the “error { error: ‘invalid_grant’” (see below) when a user tries to make a request as a user
when the add-on does not have the ACT_AS_USER at the scope.

error { error: 'invalid_grant',
  error_description: 'The oauth client ID in the issuer string was the literal "undefined". This is probably because your add-on does not have the `ACT_AS_USER` scope (or didn\'t have it at the time it was installed). Please add `ACT_AS_USER` to the `scopes` section of your descriptor, and re-install the add-on.' }

I tried with try catch but it did NOT work . Is there any other way ?

var httpClient = addon.httpClient(req).asUserByAccountId(userId);
try {
httpClient.get(’/rest/api/settings/systemInfo’, function (err, response, contents) {
reqSuccess = true;
})
} catch(error) {
console.log(error);
}

Many thanks in advance .