Add global error handling code