Re: Error Handling Change in IDL 8 [message #73003 is a reply to message #72910] |
Tue, 19 October 2010 11:31   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
David Fanning wrote:
> Well, in functions the CATCH returns some value.
> In procedures, it doesn't. Most of these ON_ERROR,2 calls
> (but not all) are in functions, and I try to be a bit
> careful about what I return. I'm not sold on the notion
> of a generic CATCH handler.
Yeah, it's not straightforward I agree.
For what I do, I'm thinking about adopting
RETURN, !NULL
for my "generic" function error handler.
I've only thought about it for about 5 minutes, so there may be unforeseen pitfalls to this approach, but I prefer
convention over configuration.
> It is not really my library routines I am worrying
> about. I'm pretty careful with Library routines.
> I'm less careful when writing one-offs to
> do science. It's these routines I am struggling with
> at the moment. It's just disconcerting to get error
> messages that don't mean a damn thing to me and do
> nothing to help me solve the problem.
I'm sorry.... "one-offs"? I associate that term with throwaway code. So, two things immediately spring to mind:
1) does anyone really write "one-offs" anymore? :o)
2) If they truly are "one-offs", what the hell are you doing worrying about error handling? Just use
ON_ERROR, 0 !!
:o)
> Alright, I'm going to quit whining about it. But
> I still think changing the way error handling works
> was a terrible idea and almost guaranteed to
> antagonize long-time customers. (If I'm the only
> one antagonized, as it appears, then perhaps
> Coyote is right that "Nobody uses damn error
> handling anyway!")
I don't think we should stop whining about it. I'm usually the first in line to whinge about decisions made by ITTVIS
but in this instance, it didn't affect me at all since I use CATCH exclusively. (Similarly for the meaning of "-1" being
returned by an unsuccessful WHERE, etc etc)
> P.S. I'm not sure how to use a Ruby script. Do you have
> that Perl script around? I can think of a few ways to use
> that! Thanks.
Well, for ruby, on your *nix system type
$ irb
If you see something like
irb(main):001:0>
then you have successfully entered the interactive ruby shell and it means ruby is installed on your system. To run a
ruby script, you should be able to just type
$ ruby script_name.rb
to run it, but there may be some envars that need setting... can't recall.
But, regardless, I will ask my colleague if he has his perl script lying around (since I can't find it in our svn repo).
cheers,
paulv
|
|
|