Catch errors from running code.