Error handling and crash reporting