I've just started working with javascript for the first time. From googling I have only been able to find examples of handling promise rejection through functions that have been written by you. My problem is that
app.getInput("key");
is not written by me. I want to be able to handle the rejected promise in my code. My brain is having trouble "getting javascript" at the moment.
I have this function (in the jovo framework)
var content = app.getInput('content');
I get the error "TypeError: Cannot read property 'content' of undefined". I know why I'm getting this error, I just want to be able to handle the situation where there is no content.
It says also "UnhandledPromiseRejectionWarning: Unhandled promise rejection"
I just want to be able to write something like
var content = "null";
content = testFunc().then(() => {
console.log('resolved content!');
}).catch((err) => {
console.log('error content');
content = "null";
});
function testFunc(){
return app.getInput('content');
}