Skip to content

Commit

Permalink
Merge branch 'master' into latest-codegen-master
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe authored Aug 31, 2023
2 parents 8582ca3 + 18d6862 commit 842c7b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Exception/ApiErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ public function setStripeCode($stripeCode)
*/
public function __toString()
{
$parentStr = parent::__toString();
$statusStr = (null === $this->getHttpStatus()) ? '' : "(Status {$this->getHttpStatus()}) ";
$idStr = (null === $this->getRequestId()) ? '' : "(Request {$this->getRequestId()}) ";

return "{$statusStr}{$idStr}{$this->getMessage()}";
return "Error sending request to Stripe: {$statusStr}{$idStr}{$this->getMessage()}\n{$parentStr}";
}

protected function constructErrorObject()
Expand Down
2 changes: 2 additions & 0 deletions tests/Stripe/Exception/ApiErrorExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ public function testToString()
{
$e = $this->createFixture();
static::compatAssertStringContainsString('(Request req_test)', (string) $e);
static::compatAssertStringContainsString('Error sending request to Stripe', (string) $e);
static::compatAssertStringContainsString('Stack trace:', (string) $e);
}
}

0 comments on commit 842c7b3

Please sign in to comment.