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