twitter-lite
twitter-lite copied to clipboard
Always throw Error objects
I was bitten by a bug where I expected a thrown err.message to exist, but it didn't since this library is throwing response objects rather than Error objects.
It's good practice to always throw Error objects (or a subclass of). This also applies to EventEmitter.emit('error', err). If you want to give the user access to additional properties you can always add those as properties of the error object.