Skip to content

Commit

Permalink
Merge pull request #101 from thinkshout/issue-95-detail
Browse files Browse the repository at this point in the history
Issue #94 checking if detail exists before appending to message.
  • Loading branch information
mariacha authored Apr 27, 2021
2 parents 9124a72 + e9ecf88 commit a5ef09f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/MailchimpAPIException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ public function __construct($message = "", $code = 0, Exception $previous = NULL
// Construct message from JSON if required.
if (substr($message, 0, 1) == '{') {
$message_obj = json_decode($message);
$message = $message_obj->status . ': ' . $message_obj->title . ' - ' . $message_obj->detail;
$message = $message_obj->status . ': ' . $message_obj->title;
if (!empty($message_obj->detail)) {
$message .= ' - ' . $message_obj->detail;
}
if (!empty($message_obj->errors)) {
$message .= ' ' . serialize($message_obj->errors);
}
Expand Down

0 comments on commit a5ef09f

Please sign in to comment.