function PsrUtils::throwOnErrorOrFalse
2 calls to PsrUtils::throwOnErrorOrFalse()
- PsrUtils::decoder in vendor/
open-telemetry/ sdk/ Common/ Export/ Http/ PsrUtils.php - PsrUtils::encoder in vendor/
open-telemetry/ sdk/ Common/ Export/ Http/ PsrUtils.php
File
-
vendor/
open-telemetry/ sdk/ Common/ Export/ Http/ PsrUtils.php, line 158
Class
- PsrUtils
- @internal
Namespace
OpenTelemetry\SDK\Common\Export\HttpCode
private static function throwOnErrorOrFalse(callable $callable) : callable {
return static function (...$args) use ($callable) {
set_error_handler(static function (int $errno, string $errstr, string $errfile, int $errline) : bool {
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
try {
$result = $callable(...$args);
} finally {
restore_error_handler();
}
/** @phan-suppress-next-line PhanPossiblyUndeclaredVariable */
if ($result === false) {
throw new LogicException();
}
/** @phan-suppress-next-line PhanPossiblyUndeclaredVariable */
return $result;
};
}