在代码中增加一个错误处理语句以处理这种情况。例如,以下代码片段展示了如何在发生“unauthorized”错误时处理错误响应:
app.handle('unexpected_response', (conv, error) => {
if (error.status === 'UNAUTHENTICATED') {
// Here is where you may want to add code to gracefully handle the error.
conv.ask('Sorry, we could not authenticate your account because of a ' +
'technical error. Please try again later.');
return;
}
conv.ask('Sorry, we ran into a problem. Please try again later.');
});