One of the rare things I dislike about Tcl/Tk is the error messages.
They pop up and I hate them.
Well, I've changed them a little. Larger, much better font, better key bindings and automatic focus so it's easier to copy the error message,
which I like to do so I can dismiss the error and paste the message
elsewhere for reference.
OK.
But this really annoys me:
can't read "dir": no such variable
can't read "dir": no such variable
while executing
"set dir"
(procedure "p.RunTime.Navigate" line 141)
invoked from within
"p.RunTime.Navigate "Up""
(command bound to event)
I hate it because line 141 is pointed out, but 141 is counted within
the proc! It's very hard to find. That is another reason for me to make copying more convenient, so I can copy the bad line and pray that I
can find it exactly.
[dict get [info frame 0] line] can give me an exact, absolute line
number in relation to the entire file so why can't Tk error messages?
What file do I hack to achieve that?
I made the changes I mentioned earlier in this file: /usr/share/tcltk/tk8.6/bgerror.tcl
Every error message says "while executing" and "invoked from within".
But grep can only find those strings in /usr/share/tcltk/tcl8.6/init.tcl.
And when I change, say, "while executing" to "while dancing hula" the
changes are not reflected in the error messages. So I won't even waste
my time trying to understand that file. What I want is not there.
Where is it?
One of the rare things I dislike about Tcl/Tk is the error messages.
They pop up and I hate them.
Well, I've changed them a little. Larger, much better font, better key bindings and automatic focus so it's easier to copy the error message,
which I like to do so I can dismiss the error and paste the message
elsewhere for reference.
OK.
But this really annoys me:
can't read "dir": no such variable
can't read "dir": no such variable
while executing
"set dir"
(procedure "p.RunTime.Navigate" line 141)
invoked from within
"p.RunTime.Navigate "Up""
(command bound to event)
I hate it because line 141 is pointed out, but 141 is counted within
the proc! It's very hard to find.
That is another reason for me to make copying more convenient, so I
can copy the bad line and pray that I can find it exactly.
[dict get [info frame 0] line] can give me an exact, absolute line
number in relation to the entire file so why can't Tk error messages?
What file do I hack to achieve that?
Where is it?
if they were not present would likely leave you with the basic C
equivalent of:
segmentation fault: process aborted
And absolutely no information on where.
If you catch your own errors you can have any form of error message
you want to code. But you have to catch the errors (via either
[catch] or [try]) and then handle the error conditions yourself.
Not a all. I jump my editor to the first line of the proc mentioned,
then I command the editor to do "down arrow" 141 times, and I arrive at
the very line that Tcl has referenced. Nothing could be simpler to
find.
Do note that the above does require one's editor to have the ability to >"repeat" an edit operation some number of times. I use joe (Joe's Own >Editor, https://en.wikipedia.org/wiki/Joe's_Own_Editor) in the jstar >configuration.
Unfortunately I have no idea. I've never been bothered by the message
(and compared to Python or Java Tcl's messages are a dream of
usefulness)
Where is it?
The default error popup window is provided by the default bgerror
handler proc provided by Tcl. On my Slackware system the default
bgerror proc is defined in /usr/lib64/tk8.6/bgerror.tcl.
On Sun, 7 Jan 2024 04:06:26 -0000 (UTC), Rich wrote:
if they were not present would likely leave you with the basic C
equivalent of:
segmentation fault: process aborted
And absolutely no information on where.
Of course, I understand, you do have a point, but you also sound like
you could have added something like "in the snow uphill both ways."
:-)
If you catch your own errors you can have any form of error message
you want to code. But you have to catch the errors (via either
[catch] or [try]) and then handle the error conditions yourself.
That suggestion calls to my mind the image of a basement with a large
array of mouse traps strewn all over, one or two going SNAP! every now
and then.
I don't want to pepper my code with God knows how many catch statements
in every possible corner. I just want a better error message.
Not a all. I jump my editor to the first line of the proc mentioned,
then I command the editor to do "down arrow" 141 times, and I arrive
at the very line that Tcl has referenced. Nothing could be simpler
to find.
Do note that the above does require one's editor to have the ability
to "repeat" an edit operation some number of times. I use joe (Joe's
Own Editor, https://en.wikipedia.org/wiki/Joe's_Own_Editor) in the
jstar configuration.
Ah. My first thought was, "Vi user detected."
I am familiar with joe, but I don't like it. I use geany. I like it
a lot.
Where is it?
The default error popup window is provided by the default bgerror
handler proc provided by Tcl. On my Slackware system the default
bgerror proc is defined in /usr/lib64/tk8.6/bgerror.tcl.
Yes, and like I said, I have already made changes to it. But I don't
think the code I am looking for so I can change it is there. It
doesn't even contain the key words seen in the error messages.
One of the rare things I dislike about Tcl/Tk is the error messages.
They pop up and I hate them.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 493 |
Nodes: | 16 (2 / 14) |
Uptime: | 20:04:01 |
Calls: | 9,718 |
Calls today: | 8 |
Files: | 13,741 |
Messages: | 6,182,080 |