/** * @param \Exception $exception * * @return self */ public static final function createFromException(\Exception $exception) { if ($exception instanceof Exception\ApiProblemExceptionInterface) { return $exception->getApiProblem(); } return self::createFromScalar(500, 'Unexpected error'); }