accounts/api/components/ErrorHandler.php

21 lines
593 B
PHP
Raw Normal View History

<?php
namespace api\components;
use api\modules\authserver\exceptions\AuthserverException;
use api\modules\session\exceptions\SessionServerException;
class ErrorHandler extends \yii\web\ErrorHandler {
public function convertExceptionToArray($exception) {
if ($exception instanceof AuthserverException || $exception instanceof SessionServerException) {
return [
'error' => $exception->getName(),
'errorMessage' => $exception->getMessage(),
];
}
return parent::convertExceptionToArray($exception);
}
}