octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rethrow?


From: John W. Eaton
Subject: Re: rethrow?
Date: Mon, 29 Jan 2007 16:40:46 -0500

On 26-Jan-2007, Paul Kienzle wrote:

| 
| On Jan 26, 2007, at 3:50 AM, David Bateman wrote:
| 
| > I can't remember early versions of matlab having this function, however
| > there seems to be a useful function called "rethrow" that can be used 
| > in
| > conjunction with try/catch like
| >
| >         try
| >             do_something
| >         catch
| >             do_cleanup
| >             rethrow(lasterror)
| >         end
| >
| > It seems like it wouldn't be hard to add this, with the only complexity
| > to me being the format of the variable lasterror.
| 
| I think I already do this somewhere:
| 
|    try
|      something
|    catch
|      fixup
|      error(lasterror)
|    end

This has a similar effect to rethrow but doesn't it make the error
appear to have happened at the location inside the catch block?  With
rethrow, I assume the information about the location of the error
remains the original call to error.  If so, then I think properly
implementing rethrow requires more than just making it an alias for
error.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]