I need catch an async exception but i can´t use async/await.
I´m trying to use promises, but it doesn´t work.
An example:
myAsyncFunction().then(function() {
console.log("EVERYTHING OK");
}).catch(function(error) {
console.log(error);
});
function myAsyncFunction() {
return new Promise(function(resolve, reject) {
externalLibraryFunctionAsyncToApiRequest(); //this function throw error
});
}
I can´t modify the externalLibraryFunctionAsynToApiRequest.
Can I do anything to catch a possible exception?