Zend\Stratigility\Exception\MiddlewareException::fromErrorValue PHP 메소드

fromErrorValue() 공개 정적인 메소드

Create an instance based on an error value.
public static fromErrorValue ( mixed $err ) : self
$err mixed
리턴 self
    public static function fromErrorValue($err)
    {
        if (is_object($err)) {
            return self::fromType(get_class($err));
        }
        if (is_array($err)) {
            return self::fromType(gettype($err));
        }
        if (is_string($err)) {
            throw new self($err);
        }
        return self::fromType(var_export($err, true));
    }

Usage Example

예제 #1
0
 /**
  * @param mixed $err
  * @throws Throwable|\Exception
  */
 private function raiseThrowableFromError($err)
 {
     if ($err instanceof Throwable || $err instanceof \Exception) {
         throw $err;
     }
     $this->triggerErrorDeprecation();
     throw Exception\MiddlewareException::fromErrorValue($err);
 }
MiddlewareException