From 5c06c0870f8e425c2d4ed0f7c330c13e1605628e Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 20 Oct 2020 18:32:46 +0200 Subject: Dislay an error if an exception occurs in the error handler Related to #1598 --- application/Utils.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'application/Utils.php') diff --git a/application/Utils.php b/application/Utils.php index bcfda65c..37be9a13 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -463,3 +463,12 @@ function t($text, $nText = '', $nb = 1, $domain = 'shaarli') { return dn__($domain, $text, $nText, $nb); } + +/** + * Converts an exception into a printable stack trace string. + */ +function exception2text(Throwable $e): string +{ + return $e->getMessage() . PHP_EOL . $e->getFile() . $e->getLine() . PHP_EOL . $e->getTraceAsString(); +} + -- cgit v1.2.3