Example #1
0
 /**
  * Constructor
  *
  * @param string    $message  The exception message
  * @param int       $code     The exception $code
  * @param string    $value    The exception content
  * @param Exception $previous The previous exception that throwed that one
  */
 public function __construct($message, $code, $value, $previous = null)
 {
     switch ($code) {
         case self::CONNECTION_ERROR:
             $message = "Impossible to connect to Database Server : {$value}, {$message}";
             $details = array('server' => $value);
             break;
         case self::QUERY_ERROR:
             $message = "An error was detected : {$message} in the Database Query : {$value}";
             $details = array('query' => $value);
             App::logger()->error($message);
             break;
     }
     parent::__construct($message, $details);
 }
Example #2
0
 /**
  * Constructor
  *
  * @param int       $type     The type of exception
  * @param string    $file     The source file that caused this exception
  * @param Exception $previous The previous exception that caused that one
  */
 public function __construct($type, $file, $previous = null)
 {
     switch ($type) {
         case self::TYPE_FILE_NOT_FOUND:
             $message = "Error creating a view from template file {$file} : No such file or directory";
             $details = array('type' => $type, 'file' => $file);
             break;
         case self::TYPE_EVAL:
             $trace = array_map(function ($t) {
                 return $t['file'] . ':' . $t['line'];
             }, $previous->getTrace());
             $message = "An error occured while building the view from file {$file} : " . $previous->getMessage() . PHP_EOL . implode(PHP_EOL, $trace);
             $details = array('type' => $type, 'file' => $file, 'error' => $preivous->getMessage());
             break;
     }
     parent::__construct($message, $details);
 }
Example #3
0
 public function __construct($message, $code, \Exception $previous = null)
 {
     $message .= ' : ' . $this->codeToMessage($code);
     parent::__construct($message, $code, $previous);
 }
Example #4
0
 public function __construct($details = array())
 {
     $message = 'Missing Behavior Method';
     $details = 'The hook <code>' . $details['hook'] . '</code> could not find method <code>' . $details['behavior'] . '::' . $details['method'] . '()</code> could not be found.';
     parent::__construct($message, 0, $details);
 }