Catch errors to prevent server from crashing