Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit fd61842

Browse files
authored
Merge pull request #1 from gfaza/feature/DTPORTAL-2738-implementing_Airbrake_for_CRBN
including the actual exception, as part of the 'onShutdown' notification payload
2 parents 6358cff + a3b93de commit fd61842

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin
22
vendor
33
composer.lock
4+
.idea/

src/ErrorHandler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ public function onError($code, $message, $file, $line) {
2727
switch ($code) {
2828
case E_NOTICE:
2929
case E_USER_NOTICE:
30-
$exc = new Errors\Notice($message, $file, $line, debug_backtrace());
30+
$exc = new Errors\Notice($message, $file, $line, debug_backtrace(), $code);
3131
break;
3232
case E_WARNING:
3333
case E_USER_WARNING:
34-
$exc = new Errors\Warning($message, $file, $line, debug_backtrace());
34+
$exc = new Errors\Warning($message, $file, $line, debug_backtrace(), $code);
3535
break;
3636
case E_ERROR:
3737
case E_CORE_ERROR:
3838
case E_RECOVERABLE_ERROR:
39-
$exc = new Errors\Fatal($message, $file, $line, debug_backtrace());
39+
$exc = new Errors\Fatal($message, $file, $line, debug_backtrace(), $code);
4040
break;
4141
case E_USER_ERROR:
4242
default:
43-
$exc = new Errors\Error($message, $file, $line, debug_backtrace());
43+
$exc = new Errors\Error($message, $file, $line, debug_backtrace(), $code);
4444
}
4545
$this->notifier->notify($exc);
4646
}
@@ -67,7 +67,7 @@ public function onShutdown()
6767
if ($error['type'] & error_reporting() === 0) {
6868
return;
6969
}
70-
$exc = new Errors\Fatal($error['message'], $error['file'], $error['line']);
70+
$exc = new Errors\Fatal($error['message'], $error['file'], $error['line'], $trace = array(), $error['type']);
7171
$this->notifier->notify($exc);
7272
}
7373

src/Errors/Base.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ class Base
1010
private $file;
1111
private $line;
1212
private $trace;
13+
private $code;
1314

14-
public function __construct($message, $file, $line, $trace = array())
15+
public function __construct($message, $file, $line, $trace = array(), $code = null)
1516
{
1617
$this->message = $message;
1718
$this->file = $file;
1819
$this->line = $line;
1920
$this->trace = $trace;
21+
$this->code = $code;
2022
}
2123

2224
public function getMessage()
@@ -38,4 +40,9 @@ public function getTrace()
3840
{
3941
return $this->trace;
4042
}
43+
44+
public function getCode()
45+
{
46+
return $this->code;
47+
}
4148
}

src/Notifier.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function buildNotice($exc)
7373
'type' => get_class($exc),
7474
'message' => $exc->getMessage(),
7575
'backtrace' => $backtrace,
76+
'code' => $exc->getCode(),
7677
);
7778

7879
$context = array(

0 commit comments

Comments
 (0)