[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-chibi 2e725bb 23/38: Add printing a stack trace to
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-chibi 2e725bb 23/38: Add printing a stack trace to the user code exceptions. |
Date: |
Sun, 1 Aug 2021 18:26:19 -0400 (EDT) |
branch: elpa/geiser-chibi
commit 2e725bb9059fa953614f6619518fd3f05adf1f88
Author: Lockywolf <lockywolf@gmail.com>
Commit: Lockywolf <lockywolf@gmail.com>
Add printing a stack trace to the user code exceptions.
---
scheme/chibi/geiser/geiser.scm | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/scheme/chibi/geiser/geiser.scm b/scheme/chibi/geiser/geiser.scm
index 376e8bf..571f125 100644
--- a/scheme/chibi/geiser/geiser.scm
+++ b/scheme/chibi/geiser/geiser.scm
@@ -34,26 +34,45 @@
;;> \scheme{(chibi show)} and written to both variables in addition
;;> to whatever was already there.
+(define (get-stack-trace)
+ (let ((err-output (open-output-string)))
+ (parameterize ((current-error-port err-output))
+ (print-stack-trace)
+ (get-output-string err-output))))
+
(define (geiser:eval module form . rest)
rest
(guard (err
(else
- (write ; to standard output (to comint)
- "Geiser-chibi falure in scheme code.")
- (show #t err)))
+ (show #t ; to standard output (to comint)
+ "Geiser-chibi falure in scheme code\n")
+ (show #t "Error: \n" err "\n")
+ (print-stack-trace)))
(let* ((output (open-output-string))
(form-analyzed (analyze form))
(result (parameterize ((current-output-port output))
- (guard (err
- (else (show #t err)
- (write-to-string (show #f err))))
- (if module
- (let ((mod (module-env (find-module module))))
- (eval form-analyzed mod))
- (eval form-analyzed))))))
+ (call/cc (lambda (continuation)
+ (with-exception-handler
+ (lambda (err)
+ (let ((stack-trace (get-stack-trace)))
+ (show #t
+ "Output (exception): "
+ err
+ " \nStack trace:\n"
+ stack-trace)
+ (continuation (write-to-string
+ (show #f
+ "Result
(exception): "
+ err
+ "\nStack trace:\n"
+ stack-trace)))))
+ (lambda () (if module
+ (let ((mod (module-env (find-module
module))))
+ (eval form-analyzed mod))
+ (eval form-analyzed)))))))))
(write ; to standard output (to comint)
`((result ,(write-to-string result))
- (output . ,(get-output-string output))))))
+ (output . ,(get-output-string output))))))
(values))
- [nongnu] elpa/geiser-chibi a672720 06/38: Add string combinators module, (continued)
- [nongnu] elpa/geiser-chibi a672720 06/38: Add string combinators module, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 88a5b09 08/38: Add scheme subroutine to find files implementing modules to chibi., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi b260b6d 09/38: Remove debug printing. Align par-style with geiser., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 397ba42 13/38: Temporarily fix the symbol-module by appending (current-directory)., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi f52a4ec 16/38: Fix indenting and parenthesis positioning., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 2a4fb4f 10/38: Add a TODO tag about symbol-location to geiser.sld, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi c860e3a 12/38: Add error reporting about missing symbols to geiser-edit.el, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 0272694 05/38: Use (car (process-lines ...)) instead of (shell-command ...), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 41929c9 03/38: Clean-up elisp code, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 5b016dd 18/38: geiser-chibi: allow passing custom argument list to chibi scheme process, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 2e725bb 23/38: Add printing a stack trace to the user code exceptions.,
Philip Kaludercic <=
- [nongnu] elpa/geiser-chibi 420909d 28/38: Use cl-lib instead of cl, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 71d003f 29/38: Fix typos, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi e57722a 14/38: Add a first version of geiser:symbol-location for local files., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi c32bd70 20/38: Rewrite geiser:eval in order to make it compatible with org-babel., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 354d399 21/38: Allow additional parameters to Chibi binary, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 7606cc3 27/38: Delete trailing whitespace, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi d153c2b 32/38: adapting to new scheme load path, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 9c6afab 36/38: fix for version, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 285d8ba 24/38: Begin the summary lines of all elisp libraries with three semicolons, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chibi 5e7ba0f 25/38: Mark the beginning of code part of elisp libraries with Code: heading, Philip Kaludercic, 2021/08/01