public function validation($error)
    {
        $url = $this->controller->request->getRequestTarget();
        $status = $code = $error->getCode();
        try {
            $this->controller->response = $this->controller->response->withStatus($status);
        } catch (Exception $e) {
            $status = 422;
            $this->controller->response = $this->controller->response->withStatus($status);
        }

        $sets = [
            'code' => $code,
            'url' => h($url),
            'message' => $error->getMessage(),
            'error' => $error,
            'errorCount' => $error->getValidationErrorCount(),
            'errors' => $error->getValidationErrors(),
            '_serialize' => ['code', 'url', 'message', 'errorCount', 'errors']
        ];
        $this->controller->set($sets);

        return $this->_outputMessage('error400');
    }