Open hypesystem opened 9 years ago
I realize that this may break backwards compatibility. Since we're in sub-1.0 this might be acceptable ...
How many people actively depend on the error code returned on error? (My assumption is that most just print or log it.)
+1
:+1:
Currently, if an invalid request is made, all that is returned is the error code. The debug message (when running with
DEBUG=node-gcm
) is not any more helpful.For example, I was trying to send a notification contianing a key
from
. This happens to be a reserved keyword. I had no way of knowing this, because all I was told wasInvalid request 400
.A better model for the callbacks on error would be returning the body as well as the status-code:
(Modified version of lines https://github.com/ToothlessGear/node-gcm/blob/2a293a6d795472a0886e0893891a4a0013b92800/lib/sender.js#L89-L92)
In my case, this gave me:
'"data" key "from" is a reserved keyword\n'
--- exactly what I needed to know.