public function __construct($originalData, \Exception $previous) { if (!is_string($originalData)) { $originalData = json_encode($originalData); } parent::__construct("An error was caught while mapping object: {$previous->getMessage()}. " . "Json of source data: '{$originalData}'", 42, $previous); }
/** * @param string|LiteObject $object Instance or class name. * @param int $property */ public function __construct($object, $property) { if (!is_string($object)) { $object = get_class($object); } parent::__construct("Trying to write to a read-only property '{$object}->{$property}'"); }
/** * @param string|LiteObject $object Instance or class name. * @param int $property */ public function __construct($object, $property) { if (!is_string($object)) { $object = get_class($object); } parent::__construct("No such property exists '{$object}->{$property}'"); }
/** * @param mixed $value */ public function __construct($value) { if (is_object($value)) { $type = get_class($value); } else { $type = gettype($value); } parent::__construct("Expecting \\DateTime, string, or unix timestamp (int), but got '{$type}' instead"); }
/** * @param array $enumValues * @param mixed $value */ public function __construct($enumValues, $value) { $expectedValues = implode(', ', array_flip($enumValues)); parent::__construct("One of '{$expectedValues}' expected. Got '{$value}' instead"); }
/** * @param string $expectedType * @param mixed $value */ public function __construct($expectedType, $value) { $type = is_object($value) ? get_class($value) : gettype($value); parent::__construct("Value of type '{$expectedType}' expected. Got {$type} instead"); }
/** * @param string $message */ public function __construct($message) { parent::__construct($message); }