[GRASS-dev] error reporting

Glynn Clements glynn at gclements.plus.com
Wed Sep 5 12:27:46 EDT 2007


Michael Barton wrote:

> Here's the generic error function I planning to add. It seems to work pretty
> good. Let me know if you see any problems or can suggest further
> enhancements. I'm going to put it into gm.tcl where it will be available to
> all GUI modules except gis_set.tcl (which runs before everything else, but
> is not sourced by the main GUI).
> 
> proc Gm::errmsg { error args } {
>     # send error report and optional message (args) to tk_messageBox
>     
>     set message ""
>     
>     if { $args != ""} {
>         set message [G_msg [join $args]]
>         append message ": "
>      }
> 
>     tk_messageBox -type ok -icon error -title [G_msg "Error"] \
>         -message "$message[G_msg $error]"
>     uplevel 1 return
>      
> };

I'm not sure that it's appropriate for the translation to be done
here; the caller has a better understanding of where the message
boundaries lie.

If it's done here, each arg should probably be translated
individually; the caller can always join any arguments which should be
translated as a whole. Even then, there's no option to have a portion
which doesn't get translated.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list