Refactor: Server: Use handleError for errors

Use a common error handler function instead of
copy-paste logging and sending 500s 'by hand.'