Google's officially supported Node.js client library for accessing Google APIs. Support for authorization and authentication with OAuth 2.0, API Keys and JWT (Service Tokens) is included.
The docs for File.save seem to imply that the promisified version of the method throws an error when saving is not successful. I assumed so because it's common for other promisified APIs where the callback-based version matches the NodeJS convention of reserving the first callback parameter for a possible error.
Nevertheless I have just been bitten by code like this:
This ran from top to bottom and did not throw any error even though the file was not stored in the bucket. Is this intentional? Did I hit a bug?
If this is intentional, should I explicitly check whether saving was successful myself or what is the suggested pattern? The following does not work because save returns a Promise<void>:
Hi,
The docs for
File.save
seem to imply that the promisified version of the method throws an error when saving is not successful. I assumed so because it's common for other promisified APIs where the callback-based version matches the NodeJS convention of reserving the first callback parameter for a possible error.Nevertheless I have just been bitten by code like this:
This ran from top to bottom and did not throw any error even though the file was not stored in the bucket. Is this intentional? Did I hit a bug?
If this is intentional, should I explicitly check whether saving was successful myself or what is the suggested pattern? The following does not work because
save
returns aPromise<void>
:Thanks!