Exceptions in Jovo


#1

Hello everyone!

Is there a way for Jovo to capture exceptions?

That is, if for example an error occurs during an interaction, is there a “try & catch” that makes a voice message such as “Sorry, this feature is not available at the moment”?

Thank you very much in advance!


#2

There might be a better solution built right into JOVO but you can try using .toIntent('YourUnhandledIntent') if you catch an error.

try {
        // Something
    }
    catch (error) {
        return this.toIntent('YourErrorMessageIntent')
    }

You can then define a YourErrorMessageIntent handler which will return your error message text.


#3

Thank you so much for answering @Marko_Arezina

Greetings,

Alberto.


#4

A “global catch” can be handled in ON_ERROR()

 ON_ERROR() {
        let error = this.$handleRequest.error;
        this.tell('Something went wrong');
    }


#5

Hi @AlexSwe,

I added that code under the last Intent in app.setHandler but when an error occurs I don’t get the defined error. The error appears as before.

I don’t know if I’m doing something wrong.

Greetings!