From e7429b1ced0c69fa7901f888f8dc25f00fc346a4 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 18 Nov 2016 13:36:23 +0100 Subject: gpgscm: Better error reporting. * tests/gpgscm/ffi.scm: Move the customized exception handling and atexit logic... * tests/gpgscm/init.scm: ... here. (throw): Record the current history. (throw'): New function that is history-aware. (rethrow): New function. (*error-hook*): Use the new throw'. * tests/gpgscm/main.c (load): Fix error handling. (main): Save and use the 'sc->retcode' as exit code. * tests/gpgscm/repl.scm (repl): Print call history. * tests/gpgscm/scheme.c (_Error_1): Make a snapshot of the history, use it to provide a accurate location of the expression causing the error at runtime, and hand the history trace to the '*error-hook*'. (opexe_5): Tag all lists at parse time with the current location. * tests/gpgscm/tests.scm: Update calls to 'throw', use 'rethrow'. Signed-off-by: Justus Winter --- tests/gpgscm/repl.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/gpgscm/repl.scm') diff --git a/tests/gpgscm/repl.scm b/tests/gpgscm/repl.scm index 78b8151a0..84454dc7c 100644 --- a/tests/gpgscm/repl.scm +++ b/tests/gpgscm/repl.scm @@ -34,7 +34,14 @@ (read (open-input-string next))))) (if (not (eof-object? c)) (begin - (catch (echo "Error:" *error*) + (catch (begin + (display (car *error*)) + (when (and (cadr *error*) + (not (null? (cadr *error*)))) + (display ": ") + (write (cadr *error*))) + (newline) + (vm-history-print (caddr *error*))) (echo " ===>" (eval c environment))) (exit (loop "")))) (exit (loop next))))))))) -- cgit v1.2.3