[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

exception backtrace for ruby/tk programs

Ferenc Engard

10/8/2003 11:50:00 PM

Hello,

I suffered with really hard debugging sessions when an unexpected
exception was thrown from a ruby callback in a ruby/tk application, as
the tk error dialog box showed only the error message itself and no
backtrace. I have had to modify TkCore.callback() to reveal the
backtrace.

Don't you miss this information? Can this be done in another way? If
not, then here is the simple patch, maybe it can be put into the
mainstream code.

------------------------------------------------------------------
root@domesticus:/usr/lib/ruby/1.8# diff -u tk.rb.old tk.rb
--- tk.rb.old 2003-10-09 01:18:38.000000000 +0200
+++ tk.rb 2003-10-09 01:40:47.000000000 +0200
@@ -772,7 +772,13 @@

#_get_eval_string(TkUtil.eval_cmd(TkCore::INTERP.tk_cmd_tbl[arg.shift],
# *arg))
cb_obj = TkCore::INTERP.tk_cmd_tbl[arg.shift]
- cb_obj.call(*arg)
+ begin
+ cb_obj.call(*arg)
+ rescue
+ # Append the backtrace to the message, so it can be displayed in
the
+ # Tk error dialog window.
+ raise $!, "#{$!} - backtrace: \n#{$!.backtrace.join("\n")}"
+ end
end

def load_cmd_on_ip(tk_cmd)
------------------------------------------------------------------

Bye:
Ferenc
2 Answers

ahoward

10/9/2003 12:12:00 AM

0

Hidetoshi NAGAI

10/16/2003 3:59:00 PM

0