ApiController::handleException PHP Method

handleException() public method

public handleException ( CExceptionEvent $event )
$event CExceptionEvent
    public function handleException(CExceptionEvent $event)
    {
        $e = $event->exception;
        if ($e instanceof services\ServiceException) {
            $this->sendResource($e->toFhirOutcome(), $e->httpStatus);
        }
        $issue_type = FhirValueSet::ISSUETYPE_TRANSIENT_EXCEPTION;
        $message = 'Internal Error';
        $status = 500;
        if ($e instanceof CDbException && substr($e->errorInfo[0], 0, 2) == '23') {
            // SQLSTATE Constraint Violation
            $issue_type = FhirValueSet::ISSUETYPE_PROCESSING_CONFLICT;
            $message = 'Constraint Violation';
            $status = 409;
        }
        $this->sendError(YII_DEBUG ? "{$e}" : $message, $status, $issue_type);
    }