alchemistcoin / sandwiched-backend

GNU General Public License v3.0
25 stars 7 forks source link

Fix express async handler error handling #6

Closed henridf closed 3 years ago

henridf commented 3 years ago

Right now, if the main handler throws, the client doesn't get a clean 500, but instead the connection is interrupted.

To repro, run the backend without a web3 url, and do:

$ curl -N "http://localhost:3000/sandwiches/<any addr>"
{
  "message": "fetching transactions"
}
curl: (18) transfer closed with outstanding read data remaining

Or just hit the backend with a bad address.

Fix this.