| 
     
      
      
      From: Kevin K. <ke...@ac...> - 2008-11-21 13:17:40
      
     
   | 
Joe English wrote:
> Some anecdotal evidence, FWIW: reviewing some old code I
> came across two places where I was initially tempted
> to use meaningful -errorcodes, but then thought
> "Why bother?  I'm never going to look at them,
> the [if {[catch { }]} { switch $::errorCode { ... } }]
> idiom is utterly unperspicuous," so I didn't.
> Had a nice try/onerror construct been available,
> I would have.   So I don't think the hypothesis
> is entirely without merit :-)  Sure, it's only
> a reduction of about 1 line of code, but that 1
> line is *ugly* code.
I think it might be informative to separate the discussion
of "meaningful errorcodes" from try/catch/finally, because
I want meaningful errorcodes for an entirely different reason.
For error messages that are likely to reach an application's
user, there is likely to be a desire for localisation.
The commonest case is filesystem errors, where presenting
the OS status ("file not found", "no permission", "I/O
error", etc.) appropriately translated makes sense. Right
now, that's incredibly hard; you have to parse the error
message and write a new one.  It would be nice to have
at least *some* error codes that can hook into msgcat
gracefully.
-- 
73 de ke9tv/2, Kevin
 |