我想捕获连接到Intent Client时输入错误的客户端电子邮件时连续输出的Auth错误。我想捕获此错误,以便告诉用户他们的电子邮件不正确。
我的代码:
const projectId = 'project123'
let config = {
credentials: {
private_key: privateKey,
client_email: clientEmail
}
}
async function getIntentList(config,projectId){
const intentClient = new dialogflow.IntentsClient(config);
const projectAgentPath = intentClient.projectAgentPath(projectId);
const request = {
parent: projectAgentPath
}
const [response] = await intentClient.listIntents(request)
}
getIntentList(config,projectId)
输出错误:
Auth error:Error: invalid_grant: Not a valid email or user ID.
Auth error:Error: invalid_grant: Not a valid email or user ID.
Auth error:Error: invalid_grant: Not a valid email or user ID.
Auth error:Error: invalid_grant: Not a valid email or user ID.