Error handling and performance monitoring