FACN3 / spend500

week 7 project
0 stars 1 forks source link

Handle all errors with more than just a console.log #42

Open finnhodgkin opened 6 years ago

finnhodgkin commented 6 years ago
if (error) {
        console.log('error checking username', err);
      }

In a handler the above code will just mean that the user never gets a response from the server. Make sure every route through your application ends with a response.end();!

Preferably also give the user nice error messages that explain what went wrong. Leaving console.logs in for yourself so you know how the server is breaking isn't always a bad idea, but it should be secondary to actually serving errors to your users.