Re: Show argument values in bgerror

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Show argument values in bgerror
De : wortkarg3 (at) *nospam* yahoo.com (Harald Oehlmann)
Groupes : comp.lang.tcl
Date : 18. Sep 2024, 15:54:35
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vcepjb$3vk7h$5@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
Am 18.09.2024 um 15:21 schrieb alexandru:
Here is the errorInfo of a true life situation.
The value of "val" is not output.
Maybe it should and it was intended so, but it's not.
So it's a bug then...
Alexandru,
it is not a bug. I don't speak about $::errorInfo, but "info errorstack", or the "-errorstack" component of the error dict.
Here is a complete example as proposed by Don (thanks !):
proc bgerrorhandler {message errordict} {
   puts "*** START OF ERROR MESSAGE ***"
   puts $message
   puts "*** ERROR INFO ***"
   puts [dict get $errordict -errorinfo]
   puts "*** ERROR STACK ***"
   foreach {call arg} [dict get $errordict -errorstack] {
     puts "$call:$arg"
   }
   puts "*** END OF ERROR MESSAGE ***"
}
interp bgerror "" bgerrorhandler
proc e1 {v} {incr v}
proc e2 {v} {e1 $v}
after idle {e2 a}
This gives the output:
*** START OF ERROR MESSAGE ***
expected integer but got "a"
*** ERROR INFO ***
expected integer but got "a"
     while executing
"incr v"
     (procedure "e1" line 1)
     invoked from within
"e1 $v"
     (procedure "e2" line 1)
     invoked from within
"e2 a"
     ("after" script)
*** ERROR STACK ***
INNER:incrScalar1Imm
CALL:e1 a
CALL:e2 a
*** END OF ERROR MESSAGE ***
So, the error info has the variable names ($v in this case), while the error stack has the values ("a" in this case).
Might this suit your needs ?
Take care,
Harald

Date Sujet#  Auteur
17 Sep 24 * Show argument values in bgerror12alexandru
18 Sep 24 +* Re: Show argument values in bgerror2et99
18 Sep 24 i`- Re: Show argument values in bgerror1alexandru
18 Sep 24 +* Re: Show argument values in bgerror8Harald Oehlmann
18 Sep 24 i`* Re: Show argument values in bgerror7alexandru
18 Sep 24 i `* Re: Show argument values in bgerror6Harald Oehlmann
18 Sep 24 i  `* Re: Show argument values in bgerror5alexandru
18 Sep 24 i   `* Re: Show argument values in bgerror4Harald Oehlmann
20 Sep 24 i    +- Re: Show argument values in bgerror1alexandru
24 Sep 24 i    `* Re: Show argument values in bgerror2rene
13 Oct 24 i     `- Re: Show argument values in bgerror1Harald Oehlmann
18 Sep 24 `- Re: Show argument values in bgerror1Don Porter

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal