Improved endpoint error handling