Does
tail(capture.output(traceback()),n=1)
do what you want?
that is
error - function(...) {
msg - paste(..., sep = )
if(!length(msg)) msg -
if(require(tcltk, quiet = TRUE)) {
tt - tktoplevel()
tkwm.title(tt, Error)
tkmsg - tktext(tt, bg = white)
Vladimir Eremeev wrote:
Does
tail(capture.output(traceback()),n=1)
do what you want?
that is
Hmmm... Seems, no...
Having the earlier error() definition and
bar-function() error(asdasdf)
ft-function() bar()
ft()
I get in the tcl/tk window:
Error in bar(): asdasdf
bar()
I
Hi, Vladimir,
In general, this won't work since traceback only contains the stack from
the last uncaught error (see ?traceback). When traceback is called below
it would be from the previous error, not the current one.
error - function() {
parent - tail(capture.output(traceback()), n = 1)
Hi, Vladimir,
Sorry, didn't see this reply. .Traceback - NULL doesn't work because of
the warning in ?traceback.
Warning:
It is undocumented where '.Traceback' is stored nor that it is
visible, and this is subject to change. Prior to R 2.4.0 it was
stored in the workspace,
Hi sundar --
maybe
myerr - function(err) err$call
foo - function() stop()
tryCatch({ foo() }, error=myerr)
foo()
suggests a way to catch errors without having to change existing code
or re-invent stop?
Martin
Sundar Dorai-Raj [EMAIL PROTECTED] writes:
Hi, Vladimir,
Sorry, didn't see
Thanks for the input. I don't think this will help either since it still
requires you know the error occurred in foo. I settled on passing the
call to error:
error - function(..., call) {}
foo - function()
error(some error, call = match.call())
Thanks,
--sundar
Martin Morgan said the
Hi,
On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote:
error - function(...) {
msg - paste(..., sep = )
if(!length(msg)) msg -
if(require(tcltk, quiet = TRUE)) {
tt - tktoplevel()
tkwm.title(tt, Error)
tkmsg - tktext(tt, bg = white)
tkinsert(tkmsg,
Thanks! That's the answer I was looking for.
--sundar
Ismail Onur Filiz said the following on 5/31/2007 12:23 PM:
Hi,
On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote:
error - function(...) {
msg - paste(..., sep = )
if(!length(msg)) msg -
if(require(tcltk, quiet =
Sorry for replying to myself, but:
On Thursday 31 May 2007 12:23:12 Ismail Onur Filiz wrote:
Hi,
On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote:
error - function(...) {
msg - paste(..., sep = )
if(!length(msg)) msg -
if(require(tcltk, quiet = TRUE)) {
tt -
Ismail Onur Filiz said the following on 5/31/2007 1:03 PM:
Sorry for replying to myself, but:
On Thursday 31 May 2007 12:23:12 Ismail Onur Filiz wrote:
Hi,
On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote:
error - function(...) {
msg - paste(..., sep = )
if(!length(msg))
Hi, All,
I'm writing a wrapper for stop that produces a popup window using tcltk.
Something like:
error - function(...) {
msg - paste(..., sep = )
if(!length(msg)) msg -
if(require(tcltk, quiet = TRUE)) {
tt - tktoplevel()
tkwm.title(tt, Error)
tkmsg - tktext(tt, bg =
11 matches
Mail list logo