blob: 45285a8d2f5ba62a80172d5bf115e45e98d53910 (
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 fix 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);
}
}
|