/** * Format the message that should be printed out for devs. * * @param Sgpatil\Orientphp\Exception $exception * @return string */ protected function formatMessage(OrientException $exception) { $data = $exception->getData(); $exceptionName = isset($data['exception']) ? $data['exception'] . ': ' : ''; $message = isset($data['message']) ? $data['message'] : $exception->getMessage(); return $exceptionName . $message; }
public function __construct($query, $bindings = array(), $exception = null) { // Let's handle Orientdb exceptions into the QueryException so that we extract // relevant info from it and send a helpful decent exception. if ($exception instanceof Neo4jException) { $message = $this->formatMessage($exception); parent::__construct($message); } elseif ($exception instanceof \Exception) { throw $exception; } else { parent::__construct($query); } }