Skip to content

Commit 3fcec0a

Browse files
🐛fix: getErrorTitle function to always return string in PixException
1 parent f321a86 commit 3fcec0a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Efi/Exception/PixException.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ public function __construct(array $error, int $code)
2424

2525
private static function getErrorTitle(array $error, int $code): string
2626
{
27-
return $error['nome'] ?? ($error['title'] ?? $error['error'] ?? ($code === 401 ? 'unauthorized' : 'request_error'));
27+
$title = $error['nome'] ?? ($error['title'] ?? $error['error'] ?? ($code === 401 ? 'unauthorized' : 'request_error'));
28+
if (is_array($title)) {
29+
return $title['message'] ?? 'request_error';
30+
}
31+
return $title;
2832
}
2933

3034
private function getErrorDescription(array $error, int $code): string

0 commit comments

Comments
 (0)