try {
$response->data = $this->model->Fetch();
} catch (ModelException $e) {
- $response->data['message'] = $e->GetMessage();
+ $response->body = $e->GetMessage();
$response->response_code = http\ResponseCode::NOT_FOUND;
+ } catch (\PDOException $e) {
+ $response->body = $e->GetMessage();
+ $response->response_code = http\ResponseCode::INTERNAL_SERVER_ERROR;
}
}
$this->model->Update();
$response->data = $this->model->Fetch();
} catch (ModelException $e) {
- $response->data['message'] = $e->GetMessage();
+ $response->body = $e->GetMessage();
$response->response_code = http\ResponseCode::NOT_FOUND;
+ } catch (\PDOException $e) {
+ $response->body = $e->GetMessage();
+ $response->response_code = http\ResponseCode::INTERNAL_SERVER_ERROR;
}
}
try {
$this->model->Delete();
} catch (ModelException $e) {
- $response->data['message'] = $e->GetMessage();
+ $response->body = $e->GetMessage();
$response->response_code = http\ResponseCode::BAD_REQUEST;
+ } catch (\PDOException $e) {
+ $response->body = $e->GetMessage();
+ $response->response_code = http\ResponseCode::INTERNAL_SERVER_ERROR;
}
}
$this->model->Insert();
$response->data = $this->model->Fetch();
} catch (ModelException $e) {
- $response->data['message'] = $e->GetMessage();
+ $response->body = $e->GetMessage();
$response->response_code = http\ResponseCode::BAD_REQUEST;
+ } catch (\PDOException $e) {
+ $response->body = $e->GetMessage();
+ $response->response_code = http\ResponseCode::INTERNAL_SERVER_ERROR;
}
}
}