-
-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #667 from getsentry/do-not-set-errorid-when-not-se…
…nding Do not return error id if we know we did not send the error
- Loading branch information
Showing
5 changed files
with
123 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
// XXX: Is there a better way to stub the client? | ||
class Dummy_Raven_Client extends Raven_Client | ||
{ | ||
private $__sent_events = array(); | ||
private static $input_stream; | ||
public $dummy_breadcrumbs_handlers_has_set = false; | ||
public $dummy_shutdown_handlers_has_set = false; | ||
|
||
public function getSentEvents() | ||
{ | ||
return $this->__sent_events; | ||
} | ||
|
||
public function send(&$data) | ||
{ | ||
if (is_callable($this->send_callback) && call_user_func_array($this->send_callback, array(&$data)) === false) { | ||
// if send_callback returns falsely, end native send | ||
return false; | ||
} | ||
|
||
$this->__sent_events[] = $data; | ||
|
||
if (!$this->server) { | ||
return false; | ||
} | ||
} | ||
|
||
public static function is_http_request() | ||
{ | ||
return true; | ||
} | ||
|
||
public static function get_auth_header($timestamp, $client, $api_key, $secret_key) | ||
{ | ||
return parent::get_auth_header($timestamp, $client, $api_key, $secret_key); | ||
} | ||
|
||
public function get_http_data() | ||
{ | ||
return parent::get_http_data(); | ||
} | ||
|
||
public function get_user_data() | ||
{ | ||
return parent::get_user_data(); | ||
} | ||
|
||
public function setInputStream($input) | ||
{ | ||
static::$input_stream = isset($_SERVER['CONTENT_TYPE']) ? $input : false; | ||
} | ||
|
||
protected static function getInputStream() | ||
{ | ||
return static::$input_stream ? static::$input_stream : file_get_contents('php://input'); | ||
} | ||
|
||
public function buildCurlCommand($url, $data, $headers) | ||
{ | ||
return parent::buildCurlCommand($url, $data, $headers); | ||
} | ||
|
||
// short circuit breadcrumbs | ||
public function registerDefaultBreadcrumbHandlers() | ||
{ | ||
$this->dummy_breadcrumbs_handlers_has_set = true; | ||
} | ||
|
||
public function registerShutdownFunction() | ||
{ | ||
$this->dummy_shutdown_handlers_has_set = true; | ||
} | ||
|
||
/** | ||
* Expose the current url method to test it | ||
* | ||
* @return string | ||
*/ | ||
public function test_get_current_url() | ||
{ | ||
return $this->get_current_url(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters