Skip to content

Commit

Permalink
Merge pull request #74 from hborras/temp-v6
Browse files Browse the repository at this point in the history
Check Headers before use in error responses
  • Loading branch information
hborras authored Mar 6, 2020
2 parents 5575342 + 9ecb070 commit 3dcb54d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/TwitterAds/Errors/RateLimit.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class RateLimit extends TwitterAdsException
public function __construct($message, $code, Exception $previous = null, $errors, $headers)
{
parent::__construct($message, $code, null, $errors);
$this->retryAfter = $headers['x_rate_limit_limit'];
$this->resetAt = $headers['x_rate_limit_reset'];
$this->retryAfter = $headers['x_rate_limit_limit'] ? $headers['x_rate_limit_limit'] : '';
$this->resetAt = $headers['x_rate_limit_reset'] ? $headers['x_rate_limit_reset'] : '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/TwitterAds/Errors/ServiceUnavailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ServiceUnavailable extends TwitterAdsException
public function __construct($message, $code, Exception $previous = null, $errors, $headers)
{
parent::__construct($message, $code, null, $errors);
$this->retryAfter = $headers['retry-after'];
$this->retryAfter = isset($headers['retry-after']) ? $headers['retry-after'] : '';
}

/**
Expand Down

0 comments on commit 3dcb54d

Please sign in to comment.