2016-08-31 16:02:14 +05:30
|
|
|
<?php
|
|
|
|
namespace api\components;
|
|
|
|
|
|
|
|
use api\modules\authserver\exceptions\AuthserverException;
|
2016-09-03 04:24:22 +05:30
|
|
|
use api\modules\session\exceptions\SessionServerException;
|
2016-08-31 16:02:14 +05:30
|
|
|
|
|
|
|
class ErrorHandler extends \yii\web\ErrorHandler {
|
|
|
|
|
|
|
|
public function convertExceptionToArray($exception) {
|
2016-09-03 04:24:22 +05:30
|
|
|
if ($exception instanceof AuthserverException || $exception instanceof SessionServerException) {
|
2016-08-31 16:02:14 +05:30
|
|
|
return [
|
2016-08-31 16:05:43 +05:30
|
|
|
'error' => $exception->getName(),
|
2016-08-31 16:02:14 +05:30
|
|
|
'errorMessage' => $exception->getMessage(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::convertExceptionToArray($exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|