octave-maintainers
[Top][All Lists]
Advanced

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

Re: Opinions: exceptions in user oct files


From: John W. Eaton
Subject: Re: Opinions: exceptions in user oct files
Date: Tue, 2 May 2017 15:06:25 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

On 05/02/2017 03:07 AM, Olaf Till wrote:
On Mon, May 01, 2017 at 01:39:22PM -0700, Mike Miller wrote:
 - Should Octave catch any unknown exception object and turn it into a
   general error message, preventing the interpreter from a hard exit?

 - Or should Octave require that user code not throw any exceptions
   other than the ones that Octave knows how to handle?

I think the latter is better, maybe with the addition that Octave
attempts a core dump.

The thing is that Octave doesn't know the consequences of the cause
for the uncaught exception in user code. If one of the consequences
is, e.g., a memory leak, the faulty user code could eat up the memory
if called in a loop with try-catch.

I don't see that it's any worse than an immediate crash because of an unhandled exception.

If I understand correctly, Mike was suggesting a generic catch block at the top level, which would then issue an error message and return to the command prompt. At that point one could choose to continue or exit. The error message might say something like "Octave encountered an unknown exception. This may be a bug in an external library, or in Octave itself. You may wish to save your work and restart Octave."

jwe





reply via email to

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