catches all server errors on both client and server side