node.js - Dialogflow Nodejs 捕获错误的凭据错误
问题描述
当我输入错误的凭据时,我想从 google auth 中捕获错误。即使我尝试捕获错误,它也只会输出 Unhandeled Promised Rejection 。
我的代码:
const dialogflow = require('dialogflow');
async function listIntents(config){
try{
const intentClient = new dialogflow.IntentsClient(config);
}
catch(error){
console.log("Error Caught")
}
}
listIntents('dfdff');
错误输出:
UnhandledPromiseRejectionWarning: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.<anonymous> (C:\Users\Hein\Desktop\telegram-bot-home\node_modules\google-auth-library\build\src\auth\googleauth.js:168:23)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Hein\Desktop\telegram-bot-home\node_modules\google-auth-library\build\src\auth\googleauth.js:19:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
解决方案
推荐阅读
- jquery - 如何在 CSS 中创建 iOS 样式的 Actionsheet 弹出窗口?
- r - 安装TTR时如何解决版本问题
- email - javax.mail:“连接被拒绝”到 smtp.gmail.com
- javascript - IntelliJ .js 文件无法识别
- json - 如何使用 POSTMAN 读取名称中带有句号的 JSON 对象?
- html - 将文本从 Excel 添加到 HTML 文件
- azure - 如何避免在重新启动 Azure VM 时清理临时文件夹?
- flutter - 使用flutter create app运行时会抛出错误
- ios - 重置 box-sizing 对 iOS Safari 网络有什么害处吗?
- react-native-android - Gradlew bundleRelease 不会在 react-native 中生成发布 apk