Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unused logging #71

Merged
merged 1 commit into from
Aug 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function teenyRequest(
const multipart = reqOpts.multipart as RequestPart[];
if (reqOpts.multipart && multipart.length === 2) {
if (!callback) {
console.log('Error, multipart without callback not implemented.');
console.error('multipart without callback not implemented.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we throw an exception or something in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have always been under the impression that trying to log like this is not awesome for libraries. The only case (I can think of) where the callback wasn't defined is if the user was expecting to get a stream back. In that case ... throwing feels correct, but also highly scary as folks are unlikely to catch it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my gut was an exception should be thrown here too, but I'm also feeling like we're down a rabbit hole, I want us to be back to a working version of teeny-request in @google-cloud/storage as soon as possible.

Let's log some tickets for this?

return;
}
const boundary: string = uuid.v4();
Expand Down Expand Up @@ -271,7 +271,6 @@ function teenyRequest(
res => {
res.body
.on('error', err => {
console.log('whoa there was an error, passing it on: ' + err);
requestStream.emit('error', err);
})
.pipe(requestStream);
Expand All @@ -280,7 +279,6 @@ function teenyRequest(
requestStream.emit('response', response);
},
err => {
console.log('such a nice error:' + err);
requestStream.emit('error', err);
}
);
Expand Down