Googleaction function to handle error in ON_ERROR


#1

Hi all,

what’s the alternative for this.$alexaSkill.getError()

ON_ERROR() {
console.log(Error: ${JSON.stringify(this.$alexaSkill.getError())});
},

I need to handle for Google action

ON_ERROR() {
// Triggered when there is an error
    console.log(`Error: ${JSON.stringify(this.$googleAction.getError())}`);
}

but that didnt work


#2

This currently only works with Alexa (which has specific error request types that Google Actions don’t have)


#3

Is this still the case? I’m also looking to log the error across platforms, including Alexa, Google Assistant and Web chatbots.


#4

It depends on the error. If you throw the errors yourself, it works with ON_ERROR. But I think Google Actions don’t have “error-requests” like Alexa Skills. (not sure here)

This should work cross-platform

app.setHandler({
  LAUNCH() {
    throw new Error('OH NO');
  },
  ON_ERROR() {
      this.tell('Something went wrong.');
  },
});