octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #40828] Exception handling: MException object


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #40828] Exception handling: MException object functions
Date: Sun, 20 Nov 2022 11:01:13 -0500 (EST)

Update of bug #40828 (project octave):

              Item Group:    Matlab Compatibility => Feature Request        

    _______________________________________________________

Follow-up Comment #22:

The patch I posted in comment #12 is a step in the right direction and the
problem with many test failures related to MException when running the test
suite appears to be solved now.

However, I noticed that the Matlab docs say that any code that detects an
error and throws an exception creates an MException object.  My patch doesn't
quite do that.  Instead, we generate some internal exception object and then
convert it to an MException object when executing "CATCH (OBJ)" blocks are
executed.  That's probably OK (does it matter to the user when the MException
object is actually created?) but then if the CATCH block does something like


catch (obj)
  obj.addCause (...);
  obj.addCorrection (...);
  rethrow (obj);
end


then the extra info added to the MException object OBJ is lost because
internally, Octave doesn't handle that info.

I can fix that, but it is a larger change than I'd like to do for Octave 8.

I see at least three options:

1. Defer all MException changes to the default branch.
2. Add MException.m on stable but don't change the way that throwing and
catching errors work, so for CATCH (OBJ), OBJ will still be a simple struct.
3. Add MException.m and apply my change from comment #12 on stable so that for
CATCH (OBJ), OBJ will be an MException object.  But (re)throwing an MException
object may lose extra "cause" and "correction" info.

Any preference about what to do?  I lean toward the third option with a note
about the missing features in the NEWS file and possibly a warning from the
MException throw and rethrow methods when the object contains extra cause or
correction info that will be lost.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?40828>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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