]> rhodes.io Git - swankr.git/commitdiff
Christophe Weblog Wiki Code Publications Music
catch errors during printing of frame locals
authorChristophe Rhodes <csr21@cantab.net>
Mon, 19 Sep 2011 13:06:23 +0000 (14:06 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Mon, 19 Sep 2011 13:06:23 +0000 (14:06 +0100)
tryCatch is R's handler-case.  (Spent some time wondering why
withCallingHandlers wasn't working, but that's handler-bind.)

swank.R

diff --git a/swank.R b/swank.R
index f0c0d15373ff150a29f291f56d89b23f9050c276..0b48ed34e1dd29f2e0f5a96bb98594fdeb227db6 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -425,7 +425,12 @@ computeRestartsForEmacs <- function (sldbState) {
   objs <- ls(envir=frame)
   list(lapply(objs, function(name) { list(quote(`:name`), name,
                                           quote(`:id`), 0,
-                                          quote(`:value`), printToString(eval(parse(text=name), envir=frame))) }),
+                                          quote(`:value`),
+                                          tryCatch({
+                                            printToString(eval(parse(text=name), envir=frame))
+                                          }, error=function(c) {
+                                            sprintf("error printing object")
+                                          }))}),
        list())
 }