]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Utils.php
Merge pull request #1601 from ArthurHoaro/feature/psr3
[github/shaarli/Shaarli.git] / application / Utils.php
index 7a9d264556213e09bd173508ecf6c63c3cc41553..bc1c9f5d6133b67eacc321b3d41da57f60b0f38d 100644 (file)
@@ -465,3 +465,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();
+}
+