Skip to content

Commit

Permalink
Merge pull request #451 from mercadopago/feature/improve-recuperable-…
Browse files Browse the repository at this point in the history
…error

Improve RecuperableError cause processing
  • Loading branch information
rhames07 committed Sep 22, 2023
2 parents be9cf1c + 20da98e commit 726e858
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/MercadoPago/Generic/RecuperableError.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ public function proccess_causes($causes){
if(is_array($cause) && (!isset($cause['code']) && !isset($cause['description']))){
$this->proccess_causes($cause);
}else{
$this->add_cause($cause['code'], $cause['description']);
$code = isset($cause['code']) ? $cause['code'] : "";
$description = $cause;
if (is_array($cause)) {
if (isset($cause['description'])) {
$description = $cause['description'];
} elseif (isset($cause['message'])) {
$description = $cause['message'];
}
}
$this->add_cause($code, $description);
}
}
}
Expand Down

0 comments on commit 726e858

Please sign in to comment.