Skip to content

Commit

Permalink
Removed redundant data (#issuecomment-209558090)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieran committed Apr 14, 2016
1 parent 9f22ba5 commit e3ad3ef
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions src/rollbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,32 +79,20 @@ public static function flush() {
}

class RollbarException {
private $level;
private $message;
private $err;
private $custom;
private $exception;

public function __construct($level, $message, Exception $err = null, $custom = null) {
$this->level = $level;
public function __construct( $message, Exception $exception = null) {
$this->message = $message;
$this->err = $err;
$this->custom = $custom;
}

public function getLevel() {
return $this->level;
$this->exception = $exception;
}

public function getMessage() {
return $this->message;
}

public function getException() {
return $this->err;
}

public function getCustom() {
return $this->custom;
return $this->exception;
}
}

Expand Down Expand Up @@ -271,15 +259,15 @@ public function queueSize() {
* Run the checkIgnore function and determine whether to send the Exception to the API or not.
*
* @param bool $isUncaught
* @param RollbarException $caller_args [level, message, err, custom]
* @param array $payload Data being sent to the API
* @param RollbarException $exception
* @param array $payload Data being sent to the API
* @return bool
*/
protected function _shouldIgnore($isUncaught, RollbarException $caller_args, array $payload)
protected function _shouldIgnore($isUncaught, RollbarException $exception, array $payload)
{
try {
if (is_callable($this->checkIgnore)
&& call_user_func_array($this->checkIgnore, array($isUncaught,$caller_args,$payload))
&& call_user_func_array($this->checkIgnore, array($isUncaught,$exception,$payload))
) {
$this->log_info('This item was not sent to Rollbar because it was ignored. '
. 'This can happen if a custom checkIgnore() function was used.');
Expand Down Expand Up @@ -338,7 +326,7 @@ protected function _report_exception(Exception $exc, $extra_data = null, $payloa
$payload = $this->build_payload($data);

// Determine whether to send the request to the API.
if ($this->_shouldIgnore(true, new RollbarException($data['level'], $exc->getMessage(), $exc), $payload)) {
if ($this->_shouldIgnore(true, new RollbarException($exc->getMessage(), $exc), $payload)) {
return;
}

Expand Down Expand Up @@ -476,7 +464,8 @@ protected function _report_php_error($errno, $errstr, $errfile, $errline) {
$payload = $this->build_payload($data);

// Determine whether to send the request to the API.
if ($this->_shouldIgnore(true, new RollbarException($level, $errstr), $payload)) {
$exception = new ErrorException($error_class, 0, $errno, $errfile, $errline);
if ($this->_shouldIgnore(true, new RollbarException($exception->getMessage(), $exception), $payload)) {
return;
}

Expand Down Expand Up @@ -523,7 +512,7 @@ protected function _report_message($message, $level, $extra_data, $payload_data)
$payload = $this->build_payload($data);

// Determine whether to send the request to the API.
if ($this->_shouldIgnore(true, new RollbarException($level, $message), $payload)) {
if ($this->_shouldIgnore(true, new RollbarException($message), $payload)) {
return;
}

Expand Down

0 comments on commit e3ad3ef

Please sign in to comment.