Skip to content

Commit 7f86a3c

Browse files
author
Samuel Martins
committed
Concatenate exception code with details on client exception
1 parent 981969b commit 7f86a3c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/ClientHandler.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ public function clientException(ClientException $exception)
1212

1313
$detail = __('exception::exceptions.client.unavailable');
1414
$code = $this->getCode('client.default');
15-
if ($this->clientExceptionCausers()::PAGARME_HOST == $requestHost) {
16-
$detail = $detail;
17-
$code = $this->getCode('client.pagarme');
15+
if ($this->clientExceptionCausers()->isPagarme($requestHost)) {
16+
$pagarMeCode = config($this->configFile.'codes.client.pagarme') ?? $code;
17+
18+
$detail = $detail.' #'.$pagarMeCode;
19+
$code = $pagarMeCode;
1820
}
1921

2022
$error = [[
@@ -33,6 +35,11 @@ public function clientExceptionCausers()
3335
{
3436
return new class() {
3537
const PAGARME_HOST = 'api.pagar.me';
38+
39+
public function isPagarme($host)
40+
{
41+
return self::PAGARME_HOST == $host;
42+
}
3643
};
3744
}
3845
}

0 commit comments

Comments
 (0)