blob: 39683f727d3fb3bfb8513c6974dfe0e4396620ae (
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
|
<?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);
}
}
|