class_mcException.inc.php
1.3 KB
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
44
45
46
47
<?php
/**
* @copyright (c) 2014, netz.coop eG
*/
class mcException extends mcEvent {
public static function handleException (Exception $e) {
// D::h2('Exception Error ('.$e->getCode().') in '.$e->getFile().' in row '.$e->getLine());
// D::e('Message: '.$e->getMessage().' '. c.'<br>');
// D::show($e->getTraceAsString(), 'TraceAsString');
// if($e->getPrevious()) {
// D::e('there is a previous exception');
// }
D::cf('ERROR', D::ALL);
if(get_class($e) == 'PDOException') {
foreach($e->getTrace() as $i => $array) {
// D::li($i);
if(array_key_exists('args', $array)) {
$out1 = null;
foreach($array['args'] as $arg) {
if(get_class ($arg) == 'PDOStatement') {
ob_start();
$arg->debugDumpParams();
$out1 = ob_get_contents();
ob_end_clean();
// D::ulli($out1);
break;
}
}
if($out1) {
break;
}
}
}
}
self::handle(E_ERROR, $e->getCode(), $e->getFile(), $e->getLine(), $e->getMessage().mcCONST::LINEBREAK.$out1);
return false;
}
public static $count =0;
private static function handle($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext) {
self::add(new mcException($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext));
self::$count++;
}
}
?>