twitter-lite icon indicating copy to clipboard operation
twitter-lite copied to clipboard

Always throw Error objects

Open deadbeef84 opened this issue 4 years ago • 0 comments

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.

deadbeef84 avatar Mar 18 '21 11:03 deadbeef84