# HG changeset patch # User John W. Eaton # Date 1711341833 14400 # Node ID 55e1412aca35bbf3296f080f752f777ca70f1360 # Parent 399be7cc310f80f94558fadaa3eceda7bd9d57b6 call error instead of abort in panic_impossible, panic_if, and panic_unless * error.cc (error_system::vpanic): Call ::verror to issue message and throw error instead of printing message directly to std::error and calling abort. * panic.h: Fix comment. diff -r 399be7cc310f -r 55e1412aca35 libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Sat Mar 23 13:54:13 2024 -0400 +++ b/libinterp/corefcn/error.cc Mon Mar 25 00:43:53 2024 -0400 @@ -633,12 +633,15 @@ void error_system::vpanic (const char *fmt, va_list args) { - // Is there any point in trying to write the panic message to the - // diary? + // Earlier versions of Octave printed a message directly to std::cerr + // and called abort. That might be acceptable behavior for some + // programs but for an interactive application like Octave, aborting + // the entire program when an internal programming error has been + // detected seems unnecessary and certainly provides a much worse user + // experience than simply generating an ordinary error message and + // attempting to return to the command prompt. - std::cerr << "panic: " << format_message (fmt, args) << std::endl; - - abort (); + ::verror (fmt, args); } void diff -r 399be7cc310f -r 55e1412aca35 libinterp/corefcn/panic.h --- a/libinterp/corefcn/panic.h Sat Mar 23 13:54:13 2024 -0400 +++ b/libinterp/corefcn/panic.h Mon Mar 25 00:43:53 2024 -0400 @@ -38,8 +38,8 @@ extern OCTINTERP_API void panic (const char *fmt, ...); // To allow the __FILE__ and __LINE__ macros to work as expected, the -// panic_impossible, panic_if, panic_unless, error_impossible, error_if, -// and error_unless symbols must be defined as macros. +// panic_impossible, panic_if, and panic_unless symbols must be defined +// as macros. #define panic_impossible() \ ::panic ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__)