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
<?php
namespace JMS\Serializer\Exception;
class XmlErrorException extends RuntimeException
{
private $xmlError;
public function __construct(\LibXMLError $error)
{
switch ($error->level) {
case LIBXML_ERR_WARNING:
$level = 'WARNING';
break;
case LIBXML_ERR_FATAL:
$level = 'FATAL';
break;
case LIBXML_ERR_ERROR:
$level = 'ERROR';
break;
default:
$level = 'UNKNOWN';
}
parent::__construct(sprintf('[%s] %s in %s (line: %d, column: %d)', $level, $error->message, $error->file, $error->line, $error->column));
$this->xmlError = $error;
}
public function getXmlError()
{
return $this->xmlError;
}
}