Skip to content

Commit

Permalink
closes #53
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Oct 10, 2024
1 parent 0d158fc commit 909daf5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [3.0.39](https://github.com/ebizmarts/mailchimp-lib/tree/3.0.39) (2024-10-10)

[Full Changelog](https://github.com/ebizmarts/mailchimp-lib/compare/3.0.38...3.0.39)

**Implemented enhancements:**

- Add the instance value to the log [\#53](https://github.com/ebizmarts/mailchimp-lib/issues/53)

## [3.0.38](https://github.com/ebizmarts/mailchimp-lib/tree/3.0.38) (2024-02-20)

[Full Changelog](https://github.com/ebizmarts/mailchimp-lib/compare/3.0.37...3.0.38)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ebizmarts/mailchimp-lib",
"type": "library",
"version": "3.0.38",
"version": "3.0.39",
"description": "API client library for the MailChimp",
"keywords": ["email", "api","mailchimp"],
"homepage": "https://github.com/ebizmarts/mailchimp-lib",
Expand Down
3 changes: 2 additions & 1 deletion src/Mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ public function call($url,$params,$method=Mailchimp::GET)
$detail = array_key_exists('detail', $result) ? $result['detail'] : '';
$errors = array_key_exists('errors', $result) ? $result['errors'] : null;
$title = array_key_exists('title', $result) ? $result['title'] : '';
throw new Mailchimp_Error($this->_root . $url, $method, $params, $title, $detail, $errors);
$instance = array_key_exists('title', $result) ? $result['instance'] : null;
throw new Mailchimp_Error($this->_root . $url, $method, $params, $title, $detail, $errors, $instance);
} else {
throw new Mailchimp_Error($this->_root . $url, $method, $params, $result);
}
Expand Down
10 changes: 9 additions & 1 deletion src/Mailchimp/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ class Mailchimp_Error extends Exception
* @var array
*/
protected $errors;
/**
* @var string
*/
protected $instance;
/**
* @var string
*/
protected $params;

public function __construct($url,$method='',$params='',$title='',$detail='',$errors=null)
public function __construct($url,$method='',$params='',$title='',$detail='',$errors=null, $instance = null)
{
$titleComplete = $title . " for Api Call: " . $url;
parent::__construct($titleComplete . " - " . $detail);
Expand All @@ -47,6 +51,7 @@ public function __construct($url,$method='',$params='',$title='',$detail='',$err
$this->method = $method;
$this->errors = $errors;
$this->params = $params;
$this->instance = $instance;
}
public function getFriendlyMessage()
{
Expand All @@ -73,6 +78,9 @@ public function getFriendlyMessage()
$lineParams = $this->params;
}
$friendlyMessage .= $lineParams;
if ($this->instance) {
$friendlyMessage .= "\n\tInstance: [".$this->instance."]\n";
}
return $friendlyMessage;
}
public function getUrl()
Expand Down

0 comments on commit 909daf5

Please sign in to comment.