public function __construct($result) { $this->result = $result; $code = 0; if (isset($result['error_code']) && is_int($result['error_code'])) { $code = $result['error_code']; } if (isset($result['error_description'])) { // OAuth 2.0 Draft 10 style $msg = $result['error_description']; } else { if (isset($result['error']) && is_array($result['error'])) { // OAuth 2.0 Draft 00 style $msg = $result['error']['message']; } else { if (isset($result['error_msg'])) { // Rest server style $msg = $result['error_msg']; } else { //$msg = 'Unknown Error. Check getResult()'; $msg = $this->result; } } } parent::__construct($msg, $code); if (Catapult\Log::isOn()) { $trace = $this->getTrace(); /** get the last line we got an error on, would be the user's file **/ $line = $trace[sizeof($trace) - 1]['line']; Catapult\Log::write(time(), "line: " . $line, $this->result); } }
/** * test write should * properly create a file * write to it. */ public function testWrite() { Catapult\Log::write(time(), "ERROR_CODE", "TEST"); }