BxDolAiTriggerTest.php 693 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * Operators see the provider's own error. The log keeps the full HTTP text.
  4. */
  5. class BxDolAiTriggerTest extends \PHPUnit\Framework\TestCase
  6. {
  7. public function testAuthenticationErrorIsTheProviderMessage()
  8. {
  9. $o = new Exception('HTTP 401 error during POST chat/completions: {"error":{"message":"Unauthorized","type":"authentication_error"}}');
  10. $this->assertSame('Unauthorized', BxDolAiTrigger::visibleError($o));
  11. }
  12. public function testPlainExceptionStaysIntact()
  13. {
  14. $o = new Exception('Vector store 9 has no embedding model');
  15. $this->assertSame('Vector store 9 has no embedding model', BxDolAiTrigger::visibleError($o));
  16. }
  17. }