Skip to content

Commit

Permalink
[add] error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
elfarqy authored and haqqi committed Jan 25, 2017
1 parent 5a25a81 commit 36ad301
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions common/components/ErrorHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace common\components;

use common\exceptions\BetterHttpException;

class ErrorHandler extends \yii\web\ErrorHandler {
protected function convertExceptionToArray($exception) {
$array = parent::convertExceptionToArray($exception);

if($exception instanceof BetterHttpException) {
$array['data'] = $exception->getData();
}

return $array;
}
}

0 comments on commit 36ad301

Please sign in to comment.