added an error handler to server.js