Skip to content

Commit

Permalink
Modifications to implement ErrorResponseException
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Aug 25, 2015
1 parent c674569 commit 7bdaf68
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/controllers/TicketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
use hipanel\modules\client\models\Client;
use hipanel\modules\ticket\models\Thread;
use hipanel\modules\ticket\models\TicketSettings;
use hipanel\modules\domain\models\Domain;
use hiqdev\hiart\HiResException;
use hiqdev\hiart\ErrorResponseException;
use Yii;
use yii\data\Sort;
use yii\helpers\ArrayHelper;

/**
* Class TicketController.
Expand Down Expand Up @@ -217,16 +214,14 @@ private function _ticketChange($options = [], $apiCall = 'Answer', $bulk = true)
{
try {
Thread::perform($apiCall, $options, $bulk);
} catch (HiResException $e) {
} catch (ErrorResponseException $e) {
return false;
}

return true;
}

/**
* @throws HiResException
*
* @return string
*/
public function actionGetQuotedAnswer()
Expand All @@ -235,7 +230,9 @@ public function actionGetQuotedAnswer()
if ($request->isAjax) {
$id = $request->post('id');
if ($id !== null) {
$answer = Thread::perform('GetAnswer', ['id' => $id]);
try {
$answer = Thread::perform('GetAnswer', ['id' => $id]);
} catch (ErrorResponseException $e) {}
if (isset($answer['message'])) {
return '> ' . str_replace("\n", "\n> ", $answer['message']);
}
Expand Down

0 comments on commit 7bdaf68

Please sign in to comment.