Skip to content

Commit a5ef09f

Browse files
authored
Merge pull request #101 from thinkshout/issue-95-detail
Issue #94 checking if detail exists before appending to message.
2 parents 9124a72 + e9ecf88 commit a5ef09f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/MailchimpAPIException.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public function __construct($message = "", $code = 0, Exception $previous = NULL
1818
// Construct message from JSON if required.
1919
if (substr($message, 0, 1) == '{') {
2020
$message_obj = json_decode($message);
21-
$message = $message_obj->status . ': ' . $message_obj->title . ' - ' . $message_obj->detail;
21+
$message = $message_obj->status . ': ' . $message_obj->title;
22+
if (!empty($message_obj->detail)) {
23+
$message .= ' - ' . $message_obj->detail;
24+
}
2225
if (!empty($message_obj->errors)) {
2326
$message .= ' ' . serialize($message_obj->errors);
2427
}

0 commit comments

Comments
 (0)