Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Unhandled promise rejection #12

@b0o

Description

@b0o

Inside the TextToSpeechClient constructor, there is a promise with an unhandled rejection case:

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'

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: texttospeechIssues related to the googleapis/nodejs-text-to-speech API.priority: p2Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions