This repository was archived by the owner on Dec 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
Unhandled promise rejection #12
Copy link
Copy link
Closed
Labels
🚨This issue needs some love.This issue needs some love.api: texttospeechIssues related to the googleapis/nodejs-text-to-speech API.Issues related to the googleapis/nodejs-text-to-speech API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.Resolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Inside the TextToSpeechClient constructor, there is a promise with an unhandled rejection case:
nodejs-text-to-speech/src/v1beta1/text_to_speech_client.js
Lines 124 to 130 in 754f4ec
| textToSpeechStub.then( | |
| stub => | |
| function() { | |
| var args = Array.prototype.slice.call(arguments, 0); | |
| return stub[methodName].apply(stub, args); | |
| } | |
| ), |
If there's a problem with the grpc client (e.g. keyfile path doesn't exist), node complains about this unhandled promise rejection case:
(node:7768) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/home/****/****/****/server/****.key.json'
(node:7768) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7768) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:7768) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/home/****/****/****/server/****.key.json'
(node:7768) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
Since the specific promise location wasn't mentioned in the above error output, I verified the location by augmenting the above code with .catch():
textToSpeechStub.then(
stub =>
function() {
var args = Array.prototype.slice.call(arguments, 0);
return stub[methodName].apply(stub, args);
}
).catch(e => {
console.log(`Error: ${e}`)
}),Which results in node no longer complaining about the unhandled promise rejection:
Error: Error: ENOENT: no such file or directory, open '/home/****/****/****/server/****.key.json'
Error: Error: ENOENT: no such file or directory, open '/home/****/****/****/server/****.key.json'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: texttospeechIssues related to the googleapis/nodejs-text-to-speech API.Issues related to the googleapis/nodejs-text-to-speech API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.Resolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.