示例#1
0
 public function __construct($errors, $message = NULL, $variables = NULL, $errno = NULL, array $debug = NULL, Exception $previous = NULL)
 {
     if (class_exists('ORM_Validation_Exception') && $errors instanceof ORM_Validation_Exception) {
         $errors = $errors->errors('model');
     } elseif ($errors instanceof RestfulAPI_Validation) {
         $errors = $errors->errors();
     } elseif ($errors instanceof Validation) {
         $errors = $errors->errors('validation');
     }
     $this->_errors = Kohana_Arr::flatten($errors);
     parent::__construct(422, $message, $variables, $errno, $debug, $previous);
 }
示例#2
0
 public function __construct($message = NULL, array $variables = NULL, $errno = NULL, array $debug = NULL, Exception $previous = NULL)
 {
     parent::__construct(403, $message, $variables, $errno, $debug, $previous);
 }
示例#3
0
 /**
  * @param Exception $e
  */
 protected function exception(Exception $e)
 {
     if (class_exists('ORM_Validation_Exception') && $e instanceof ORM_Validation_Exception) {
         $e = new RestfulAPI_Exception_422($e);
     } elseif ($e instanceof Exception_Conflict) {
         $e = new RestfulAPI_Exception(409, $e->getMessage(), NULL, $e->getCode(), NULL, $e);
     }
     if ($e instanceof RestfulAPI_Exception) {
         if ($e instanceof RestfulAPI_Exception_422) {
             $this->_response_errors = Helpers_Arr::asArray($e->getErrors());
         }
         $this->error($e, $e->getCode(), $e->getErrno(), $e->getDebug());
     } else {
         $this->error($e, $e->getCode());
     }
 }