[Sciviews-commits] r137 - pkg/svMisc/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 3 17:49:11 CEST 2009


Author: prezez
Date: 2009-06-03 17:49:10 +0200 (Wed, 03 Jun 2009)
New Revision: 137

Modified:
   pkg/svMisc/R/
   pkg/svMisc/R/captureAll.R
Log:
captureAll modified to capture also messages directed to stderr


Property changes on: pkg/svMisc/R
___________________________________________________________________
Name: svn:ignore
   + !*
*-dev.*


Modified: pkg/svMisc/R/captureAll.R
===================================================================
--- pkg/svMisc/R/captureAll.R	2009-05-30 09:13:40 UTC (rev 136)
+++ pkg/svMisc/R/captureAll.R	2009-06-03 15:49:10 UTC (rev 137)
@@ -109,8 +109,8 @@
 					cat(msg)
 
 				}
-			},
-			interrupt = function (i) cat(.gettext("<INTERRUPTED!>\n"))
+			}
+			, interrupt = function (i) cat(.gettext("<INTERRUPTED!>\n"))
 			# this is modified code from base::try
 			, error = function(e) {
 				call <- conditionCall(e)
@@ -124,11 +124,11 @@
 					call <- NULL
 				if (!is.null(call)) {
 					dcall <- deparse(call)[1]
-					prefix <- paste(.gettext("Error in"), dcall, ": ")
+					prefix <- paste(.gettext("Error in "), dcall, ": ")
 					sm <- strsplit(msg, "\n")[[1]]
 					if (nchar(dcall, type="w") + nchar(sm[1], type="w") > 61) # to match value in errors.c
 						prefix <- paste(prefix, "\n  ", sep = "")
-				} else prefix <- .gettext("Error : ")
+				} else prefix <- .gettext("Error: ")
 
 				msg <- paste(prefix, msg, "\n", sep="")
 				## Store the error message for legacy uses of try() with
@@ -138,6 +138,10 @@
 					cat(msg)
 				}
 			}
+			, message = function(e) {
+				signalCondition(e)
+				cat(conditionMessage(e))
+			}
 		), silent = TRUE)
 		# Possibly add 'last.warning' as attribute to res
 		if (exists("warns", envir = TempEnv())) {
@@ -171,24 +175,9 @@
 		return(invisible(n.warn))
 	}
 
-
 	for (i in 1:length(expr)) {
 		tmp <- evalVis(expr[[i]])
 		if (inherits(tmp, "try-error")) {
-
-	# This is not necessary any more, since errors are printed by error handler:
-	#{{
-	#
-	#   		# Rework the error message if occurring in calling env
-	#		mess <- unclass(tmp)
-	#		# if (regexpr("eval\\.with\\.vis[(]Expr, myEvalEnv\\.\\., baseenv[(][)][)]", # strange regexp?
-	#		# this is simplier
-	#		if (regexpr(callFromEvalEnv, mess, fixed = TRUE) > 0)
-	#			mess <- sub("^[^:]+: *(\n *\t*| *\t*)", .gettext("Error: "), mess)
-	#		cat(mess)
-	#}}
-
-
 			last.warning <- attr(tmp, "last.warning")
 			if (!is.null(last.warning)) {
 				cat(.gettext("In addition: "))



More information about the Sciviews-commits mailing list