blob: 461dabe1358a5d7a223499497b2b459024b10312 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?php
namespace Engelsystem\Exceptions\Handlers;
use Engelsystem\Http\Request;
use Throwable;
class Legacy implements HandlerInterface
{
/**
* @param Request $request
* @param Throwable $e
*/
public function render($request, Throwable $e)
{
echo 'An <del>un</del>expected error occurred, a team of untrained monkeys has been dispatched to deal with it.';
}
/**
* @param Throwable $e
*/
public function report(Throwable $e)
{
error_log(sprintf(
'Exception: Code: %s, Message: %s, File: %s:%u, Trace: %s',
$e->getCode(),
$e->getMessage(),
$this->stripBasePath($e->getFile()),
$e->getLine(),
json_encode($e->getTrace())
));
}
/**
* @param string $path
* @return string
*/
protected function stripBasePath($path)
{
$basePath = realpath(__DIR__ . '/../../..') . '/';
return str_replace($basePath, '', $path);
}
}
|