Add throwableToString method to Utilities class

This commit is contained in:
netkas 2024-09-27 14:21:54 -04:00
parent dcdbb4f68a
commit 38092a639e

View file

@ -105,4 +105,16 @@ class Utilities
return $headers; return $headers;
} }
public static function throwableToString(\Throwable $e): string
{
return sprintf(
"%s: %s in %s:%d\nStack trace:\n%s",
get_class($e),
$e->getMessage(),
$e->getFile(),
$e->getLine(),
$e->getTraceAsString()
);
}
} }