- Add defensive check for response.body existence to prevent undefined property access
- Include x-ms-error-code header in error messages for better debugging
- Provide clearer error messages for different failure scenarios
- Fix 'Cannot read properties of undefined (reading 'error')' runtime error
This improves the debugging experience when AI service requests fail due to
network issues, authentication errors, or unexpected response formats.