-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
coretype: 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
I tried to open an nonexisting file. It succeeded and gave me the following contents:
<?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message></Error>
I'd prefer the function threw an exception of called 'error'.
My code
var content = '';
var readStream = bucket.file(data.name).createReadStream();
readStream.on('data', function(buf) { content += buf.toString(); });
readStream.on('end', function() {
console.log("got file data: " + content);
});
readStream.on('error', function(err) {
console.log("Error opening a gcs file " + data.name + ": " + err)
});
output:
got file data: NoSuchKeyThe specified key does not exist.
EDIT: I actually also got an error message, see below.
Metadata
Metadata
Assignees
Labels
coretype: 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.