ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 206 forks source link

Error message not available #49

Closed ilongin closed 10 years ago

ilongin commented 10 years ago

I've put wrong apiKey and I've expected some error message like unauthorized and all I got in callback is null on both err and result. I think this is bad because client should know what caused an error (is it wrong apiKey or maybe GCM is unavailable or wrong payload is sent). I could make pull request by myself to fix this but first I am asking you what do you think about this.

Also I've seen much console.logs in code which is also bad because people usually don't want to have console.logs in production code, specially from some dependency libraries. You could use some debug library that client can turn on with environment variable like in this module : https://github.com/petkaantonov/bluebird

Ivan

ToothlessGear commented 10 years ago

You're right, I checked it right now. It makes a simple 'Unauthorized' log entry, and supposed to return res.statusCode, yet it returns null.

Addressing you second suggestion, yes, it would be probably a good idea to implement something like a verbose flag.

ilongin commented 10 years ago

Do you want me to fix this issues or you want to do that ?

ToothlessGear commented 10 years ago

You can do it if you want to, go ahead. Thanks!

ilongin commented 10 years ago

I will do it in a few days.

ilongin commented 10 years ago

Hi,

looks like code really returns res.statusCode. Problem was that I had installed older version of this module (european npm registry is not so up to date as I can see). But I have removed console.logs and replaced them with debug module and it is all in pull request.

Ivan