GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::error_system Class Reference

#include "error.h"

Collaboration diagram for octave::error_system:

Public Member Functions

 error_system (const error_system &)=delete
 
 error_system (interpreter &interp)
 
 ~error_system (void)=default
 
bool backtrace_on_warning (bool flag)
 
octave_value backtrace_on_warning (const octave_value_list &args, int nargout)
 
bool backtrace_on_warning (void) const
 
bool beep_on_error (bool flag)
 
octave_value beep_on_error (const octave_value_list &args, int nargout)
 
bool beep_on_error (void) const
 
bool debug_on_caught (bool flag)
 
octave_value debug_on_caught (const octave_value_list &args, int nargout)
 
bool debug_on_caught (void) const
 
bool debug_on_error (bool flag)
 
octave_value debug_on_error (const octave_value_list &args, int nargout)
 
bool debug_on_error (void) const
 
bool debug_on_warning (bool flag)
 
octave_value debug_on_warning (const octave_value_list &args, int nargout)
 
bool debug_on_warning (void) const
 
std::string default_warning_state (void)
 
void disable_warning (const std::string &id)
 
bool discard_warning_messages (bool flag)
 
octave_value discard_warning_messages (const octave_value_list &args, int nargout)
 
bool discard_warning_messages (void) const
 
void display_exception (const execution_exception &e, std::ostream &os) const
 
void display_warning_options (std::ostream &os)
 
OCTAVE_NORETURN void error_1 (const char *id, const char *fmt, va_list args)
 
OCTAVE_NORETURN void error_1 (execution_exception &e, const char *id, const char *fmt, va_list args)
 
void initialize_default_warning_state (void)
 
void interpreter_try (octave::unwind_protect &frame)
 
octave_value last_error_id (const octave_value_list &args, int nargout)
 
std::string last_error_id (const std::string &s)
 
std::string last_error_id (void) const
 
octave_value last_error_message (const octave_value_list &args, int nargout)
 
std::string last_error_message (const std::string &s)
 
std::string last_error_message (void) const
 
octave_map last_error_stack (const octave_map &new_val)
 
octave_map last_error_stack (void) const
 
octave_value last_warning_id (const octave_value_list &args, int nargout)
 
std::string last_warning_id (const std::string &s)
 
std::string last_warning_id (void) const
 
octave_value last_warning_message (const octave_value_list &args, int nargout)
 
std::string last_warning_message (const std::string &s)
 
std::string last_warning_message (void) const
 
error_systemoperator= (const error_system &)=delete
 
OCTAVE_NORETURN void panic (const char *fmt,...)
 
bool quiet_warning (bool flag)
 
octave_value quiet_warning (const octave_value_list &args, int nargout)
 
bool quiet_warning (void) const
 
OCTAVE_NORETURN void rethrow_error (const std::string &id, const std::string &msg, const octave_map &stack)
 
void save_exception (const execution_exception &e)
 
void set_backtrace_on_warning (bool flag)
 
void set_beep_on_error (bool flag)
 
void set_debug_on_caught (bool flag)
 
void set_debug_on_error (bool flag)
 
void set_debug_on_warning (bool flag)
 
void set_discard_warning_messages (bool flag)
 
void set_last_error_id (const std::string &val)
 
void set_last_error_message (const std::string &val)
 
void set_last_error_stack (const octave_map &val)
 
void set_last_warning_id (const std::string &val)
 
void set_last_warning_message (const std::string &val)
 
void set_quiet_warning (bool flag)
 
void set_verbose_warning (bool flag)
 
void set_warning_option (const std::string &state, const std::string &id)
 
void set_warning_options (const octave_map &val)
 
OCTAVE_NORETURN void throw_error (const std::string &err_type, const std::string &id, const std::string &message, const std::list< frame_info > &stack_info=std::list< frame_info >())
 
OCTAVE_NORETURN void throw_error (execution_exception &e)
 
bool verbose_warning (bool flag)
 
octave_value verbose_warning (const octave_value_list &args, int nargout)
 
bool verbose_warning (void) const
 
void verror (bool save_last_error, std::ostream &os, const char *name, const char *id, const char *fmt, va_list args, bool with_cfn=false)
 
OCTAVE_NORETURN void vpanic (const char *fmt, va_list args)
 
OCTAVE_NORETURN void vusage (const char *id, const char *fmt, va_list args)
 
void vwarning (const char *id, const char *fmt, va_list args)
 
void vwarning (const char *name, const char *id, const char *fmt, va_list args)
 
int warning_enabled (const std::string &id)
 For given warning ID, return 0 if warnings are disabled, 1 if enabled, and 2 if the given ID should be an error instead of a warning. More...
 
octave_map warning_options (const octave_map &new_val)
 
octave_map warning_options (void) const
 
octave_scalar_map warning_query (const std::string &id_arg)
 

Static Public Member Functions

static std::list< octave::frame_info > make_stack_frame_list (const octave_map &stack)
 
static octave_map make_stack_map (const std::list< octave::frame_info > &frames)
 

Private Attributes

bool m_backtrace_on_warning
 TRUE means that Octave will try to display a stack trace when a warning is encountered. More...
 
bool m_beep_on_error
 TRUE means that Octave will try to beep obnoxiously before printing error messages. More...
 
bool m_debug_on_caught
 TRUE means that Octave will try to enter the debugger when an error is encountered within the 'try' section of a 'try' / 'catch' block. More...
 
bool m_debug_on_error
 TRUE means that Octave will try to enter the debugger when an error is encountered. More...
 
bool m_debug_on_warning
 TRUE means that Octave will try to enter the debugger when a warning is encountered. More...
 
bool m_discard_warning_messages
 TRUE means warning messages are turned off. More...
 
interpreterm_interpreter
 
std::string m_last_error_id
 The last error message id. More...
 
std::string m_last_error_message
 The text of the last error message. More...
 
octave_map m_last_error_stack
 The last file in which an error occurred. More...
 
std::string m_last_warning_id
 The last warning message id. More...
 
std::string m_last_warning_message
 The text of the last warning message. More...
 
bool m_quiet_warning
 TRUE means that Octave will print no warnings, but lastwarn will be updated. More...
 
bool m_verbose_warning
 TRUE means that Octave will print a verbose warning. More...
 
octave_map m_warning_options
 A structure containing (most of) the current state of warnings. More...
 

Detailed Description

Definition at line 47 of file error.h.

Constructor & Destructor Documentation

◆ error_system() [1/2]

octave::error_system::error_system ( interpreter interp)

Definition at line 256 of file error.cc.

References initialize_default_warning_state().

◆ error_system() [2/2]

octave::error_system::error_system ( const error_system )
delete

◆ ~error_system()

octave::error_system::~error_system ( void  )
default

Member Function Documentation

◆ backtrace_on_warning() [1/3]

bool octave::error_system::backtrace_on_warning ( bool  flag)
inline

Definition at line 131 of file error.h.

References m_backtrace_on_warning.

◆ backtrace_on_warning() [2/3]

octave_value octave::error_system::backtrace_on_warning ( const octave_value_list args,
int  nargout 
)

Definition at line 313 of file error.cc.

References m_backtrace_on_warning, and set_internal_variable().

Referenced by Fwarning().

◆ backtrace_on_warning() [3/3]

bool octave::error_system::backtrace_on_warning ( void  ) const
inline

Definition at line 129 of file error.h.

References m_backtrace_on_warning.

Referenced by vwarning().

◆ beep_on_error() [1/3]

bool octave::error_system::beep_on_error ( bool  flag)
inline

Definition at line 118 of file error.h.

References m_beep_on_error.

◆ beep_on_error() [2/3]

octave_value octave::error_system::beep_on_error ( const octave_value_list args,
int  nargout 
)

Definition at line 306 of file error.cc.

References m_beep_on_error, and set_internal_variable().

Referenced by Fbeep_on_error(), and octave::interpreter::maximum_braindamage().

◆ beep_on_error() [3/3]

bool octave::error_system::beep_on_error ( void  ) const
inline

Definition at line 116 of file error.h.

References m_beep_on_error.

◆ debug_on_caught() [1/3]

bool octave::error_system::debug_on_caught ( bool  flag)
inline

Definition at line 78 of file error.h.

References m_debug_on_caught.

◆ debug_on_caught() [2/3]

◆ debug_on_caught() [3/3]

bool octave::error_system::debug_on_caught ( void  ) const
inline

Definition at line 76 of file error.h.

References m_debug_on_caught.

◆ debug_on_error() [1/3]

bool octave::error_system::debug_on_error ( bool  flag)
inline

Definition at line 65 of file error.h.

References m_debug_on_error.

◆ debug_on_error() [2/3]

◆ debug_on_error() [3/3]

bool octave::error_system::debug_on_error ( void  ) const
inline

Definition at line 63 of file error.h.

References m_debug_on_error.

◆ debug_on_warning() [1/3]

bool octave::error_system::debug_on_warning ( bool  flag)
inline

Definition at line 91 of file error.h.

References m_debug_on_warning.

◆ debug_on_warning() [2/3]

◆ debug_on_warning() [3/3]

bool octave::error_system::debug_on_warning ( void  ) const
inline

Definition at line 89 of file error.h.

References m_debug_on_warning.

Referenced by vwarning().

◆ default_warning_state()

std::string octave::error_system::default_warning_state ( void  )

◆ disable_warning()

void octave::error_system::disable_warning ( const std::string &  id)

Definition at line 833 of file error.cc.

References set_warning_option().

Referenced by disable_warning(), and initialize_default_warning_state().

◆ discard_warning_messages() [1/3]

bool octave::error_system::discard_warning_messages ( bool  flag)
inline

Definition at line 105 of file error.h.

References m_discard_warning_messages.

◆ discard_warning_messages() [2/3]

octave_value octave::error_system::discard_warning_messages ( const octave_value_list args,
int  nargout 
)

◆ discard_warning_messages() [3/3]

bool octave::error_system::discard_warning_messages ( void  ) const
inline

Definition at line 103 of file error.h.

References m_discard_warning_messages.

Referenced by vwarning().

◆ display_exception()

void octave::error_system::display_exception ( const execution_exception e,
std::ostream &  os 
) const

◆ display_warning_options()

void octave::error_system::display_warning_options ( std::ostream &  os)

◆ error_1() [1/2]

void octave::error_system::error_1 ( const char *  id,
const char *  fmt,
va_list  args 
)

Definition at line 592 of file error.cc.

References format_message(), message(), and throw_error().

◆ error_1() [2/2]

void octave::error_system::error_1 ( execution_exception e,
const char *  id,
const char *  fmt,
va_list  args 
)

Definition at line 583 of file error.cc.

References format_message(), and throw_error().

Referenced by error_1(), and vwarning().

◆ initialize_default_warning_state()

void octave::error_system::initialize_default_warning_state ( void  )

Definition at line 838 of file error.cc.

References disable_warning(), octave::init_warning_options(), and warning_options().

Referenced by error_system().

◆ interpreter_try()

void octave::error_system::interpreter_try ( octave::unwind_protect frame)

◆ last_error_id() [1/3]

octave_value octave::error_system::last_error_id ( const octave_value_list args,
int  nargout 
)

◆ last_error_id() [2/3]

std::string octave::error_system::last_error_id ( const std::string &  s)
inline

Definition at line 220 of file error.h.

References m_last_error_id.

◆ last_error_id() [3/3]

std::string octave::error_system::last_error_id ( void  ) const
inline

Definition at line 218 of file error.h.

References m_last_error_id.

Referenced by save_exception().

◆ last_error_message() [1/3]

octave_value octave::error_system::last_error_message ( const octave_value_list args,
int  nargout 
)

◆ last_error_message() [2/3]

std::string octave::error_system::last_error_message ( const std::string &  s)
inline

Definition at line 181 of file error.h.

References m_last_error_message.

◆ last_error_message() [3/3]

std::string octave::error_system::last_error_message ( void  ) const
inline

Definition at line 179 of file error.h.

References m_last_error_message.

Referenced by save_exception().

◆ last_error_stack() [1/2]

octave_map octave::error_system::last_error_stack ( const octave_map new_val)
inline

Definition at line 234 of file error.h.

References m_last_error_stack.

◆ last_error_stack() [2/2]

octave_map octave::error_system::last_error_stack ( void  ) const
inline

◆ last_warning_id() [1/3]

octave_value octave::error_system::last_warning_id ( const octave_value_list args,
int  nargout 
)

Definition at line 350 of file error.cc.

References m_last_warning_id, and set_internal_variable().

Referenced by Flastwarn(), Fwarning(), and last_warning_id().

◆ last_warning_id() [2/3]

std::string octave::error_system::last_warning_id ( const std::string &  s)
inline

Definition at line 207 of file error.h.

References m_last_warning_id.

◆ last_warning_id() [3/3]

std::string octave::error_system::last_warning_id ( void  ) const
inline

Definition at line 205 of file error.h.

References m_last_warning_id.

Referenced by vwarning(), and warning_query().

◆ last_warning_message() [1/3]

octave_value octave::error_system::last_warning_message ( const octave_value_list args,
int  nargout 
)

◆ last_warning_message() [2/3]

std::string octave::error_system::last_warning_message ( const std::string &  s)
inline

Definition at line 194 of file error.h.

References m_last_warning_message.

◆ last_warning_message() [3/3]

std::string octave::error_system::last_warning_message ( void  ) const
inline

Definition at line 192 of file error.h.

References m_last_warning_message.

Referenced by vwarning().

◆ make_stack_frame_list()

std::list< octave::frame_info > octave::error_system::make_stack_frame_list ( const octave_map stack)
static

Definition at line 408 of file error.cc.

References octave_map::contains(), octave_map::contents(), and name.

Referenced by Ferror(), and rethrow_error().

◆ make_stack_map()

octave_map octave::error_system::make_stack_map ( const std::list< octave::frame_info > &  frames)
static

Definition at line 371 of file error.cc.

References line::line(), octave::bt_fields, name, and retval.

Referenced by save_exception().

◆ operator=()

error_system& octave::error_system::operator= ( const error_system )
delete

◆ panic()

void octave::error_system::panic ( const char *  fmt,
  ... 
)

Definition at line 645 of file error.cc.

References vpanic().

◆ quiet_warning() [1/3]

bool octave::error_system::quiet_warning ( bool  flag)
inline

Definition at line 157 of file error.h.

References m_quiet_warning.

◆ quiet_warning() [2/3]

octave_value octave::error_system::quiet_warning ( const octave_value_list args,
int  nargout 
)

Definition at line 328 of file error.cc.

References m_quiet_warning, and set_internal_variable().

Referenced by Fwarning().

◆ quiet_warning() [3/3]

bool octave::error_system::quiet_warning ( void  ) const
inline

Definition at line 155 of file error.h.

References m_quiet_warning.

Referenced by vwarning().

◆ rethrow_error()

void octave::error_system::rethrow_error ( const std::string &  id,
const std::string &  msg,
const octave_map stack 
)

Definition at line 616 of file error.cc.

References octave_map::contains(), error(), octave_map::isempty(), make_stack_frame_list(), and throw_error().

Referenced by Frethrow().

◆ save_exception()

◆ set_backtrace_on_warning()

void octave::error_system::set_backtrace_on_warning ( bool  flag)
inline

Definition at line 127 of file error.h.

References m_backtrace_on_warning.

◆ set_beep_on_error()

void octave::error_system::set_beep_on_error ( bool  flag)
inline

Definition at line 114 of file error.h.

References m_beep_on_error.

◆ set_debug_on_caught()

void octave::error_system::set_debug_on_caught ( bool  flag)
inline

Definition at line 74 of file error.h.

References m_debug_on_caught.

◆ set_debug_on_error()

void octave::error_system::set_debug_on_error ( bool  flag)
inline

Definition at line 61 of file error.h.

References m_debug_on_error.

Referenced by octave::tree_evaluator::enter_debugger().

◆ set_debug_on_warning()

void octave::error_system::set_debug_on_warning ( bool  flag)
inline

Definition at line 87 of file error.h.

References m_debug_on_warning.

Referenced by octave::tree_evaluator::enter_debugger().

◆ set_discard_warning_messages()

void octave::error_system::set_discard_warning_messages ( bool  flag)
inline

◆ set_last_error_id()

void octave::error_system::set_last_error_id ( const std::string &  val)
inline

Definition at line 216 of file error.h.

References m_last_error_id.

◆ set_last_error_message()

void octave::error_system::set_last_error_message ( const std::string &  val)
inline

Definition at line 177 of file error.h.

References m_last_error_message.

◆ set_last_error_stack()

void octave::error_system::set_last_error_stack ( const octave_map val)
inline

Definition at line 227 of file error.h.

References m_last_error_stack.

◆ set_last_warning_id()

void octave::error_system::set_last_warning_id ( const std::string &  val)
inline

Definition at line 203 of file error.h.

References m_last_warning_id.

◆ set_last_warning_message()

void octave::error_system::set_last_warning_message ( const std::string &  val)
inline

◆ set_quiet_warning()

void octave::error_system::set_quiet_warning ( bool  flag)
inline

Definition at line 153 of file error.h.

References m_quiet_warning.

◆ set_verbose_warning()

void octave::error_system::set_verbose_warning ( bool  flag)
inline

Definition at line 140 of file error.h.

References m_verbose_warning.

◆ set_warning_option()

void octave::error_system::set_warning_option ( const std::string &  state,
const std::string &  id 
)

◆ set_warning_options()

void octave::error_system::set_warning_options ( const octave_map val)
inline

Definition at line 166 of file error.h.

References m_warning_options.

◆ throw_error() [1/2]

void octave::error_system::throw_error ( const std::string &  err_type,
const std::string &  id,
const std::string &  message,
const std::list< frame_info > &  stack_info = std::list<frame_info> () 
)

◆ throw_error() [2/2]

void octave::error_system::throw_error ( execution_exception e)

Definition at line 894 of file error.cc.

◆ verbose_warning() [1/3]

bool octave::error_system::verbose_warning ( bool  flag)
inline

Definition at line 144 of file error.h.

References m_verbose_warning.

◆ verbose_warning() [2/3]

octave_value octave::error_system::verbose_warning ( const octave_value_list args,
int  nargout 
)

Definition at line 321 of file error.cc.

References m_verbose_warning, and set_internal_variable().

Referenced by Fwarning().

◆ verbose_warning() [3/3]

bool octave::error_system::verbose_warning ( void  ) const
inline

Definition at line 142 of file error.h.

References m_verbose_warning.

◆ verror()

void octave::error_system::verror ( bool  save_last_error,
std::ostream &  os,
const char *  name,
const char *  id,
const char *  fmt,
va_list  args,
bool  with_cfn = false 
)

◆ vpanic()

void octave::error_system::vpanic ( const char *  fmt,
va_list  args 
)

Definition at line 635 of file error.cc.

References format_message().

Referenced by panic(), and vpanic().

◆ vusage()

void octave::error_system::vusage ( const char *  id,
const char *  fmt,
va_list  args 
)

Definition at line 511 of file error.cc.

References format_message(), message(), and throw_error().

Referenced by vusage_with_id().

◆ vwarning() [1/2]

void octave::error_system::vwarning ( const char *  id,
const char *  fmt,
va_list  args 
)

Definition at line 602 of file error.cc.

References error_1(), vwarning(), and warning_enabled().

◆ vwarning() [2/2]

◆ warning_enabled()

int octave::error_system::warning_enabled ( const std::string &  id)

For given warning ID, return 0 if warnings are disabled, 1 if enabled, and 2 if the given ID should be an error instead of a warning.

Definition at line 439 of file error.cc.

References check_state(), octave_map::contents(), octave_map::numel(), retval, octave::state, octave_value::string_value(), and warning_options().

Referenced by vwarning(), and warning_enabled().

◆ warning_options() [1/2]

octave_map octave::error_system::warning_options ( const octave_map new_val)
inline

Definition at line 168 of file error.h.

References m_warning_options.

◆ warning_options() [2/2]

octave_map octave::error_system::warning_options ( void  ) const
inline

◆ warning_query()

octave_scalar_map octave::error_system::warning_query ( const std::string &  id_arg)

Member Data Documentation

◆ m_backtrace_on_warning

bool octave::error_system::m_backtrace_on_warning
private

TRUE means that Octave will try to display a stack trace when a warning is encountered.

Definition at line 344 of file error.h.

Referenced by backtrace_on_warning(), and set_backtrace_on_warning().

◆ m_beep_on_error

bool octave::error_system::m_beep_on_error
private

TRUE means that Octave will try to beep obnoxiously before printing error messages.

Definition at line 340 of file error.h.

Referenced by beep_on_error(), display_exception(), and set_beep_on_error().

◆ m_debug_on_caught

bool octave::error_system::m_debug_on_caught
private

TRUE means that Octave will try to enter the debugger when an error is encountered within the 'try' section of a 'try' / 'catch' block.

Definition at line 327 of file error.h.

Referenced by debug_on_caught(), and set_debug_on_caught().

◆ m_debug_on_error

bool octave::error_system::m_debug_on_error
private

TRUE means that Octave will try to enter the debugger when an error is encountered.

This will also inhibit printing of the normal traceback message (you will only see the top-level error message).

Definition at line 322 of file error.h.

Referenced by debug_on_error(), interpreter_try(), and set_debug_on_error().

◆ m_debug_on_warning

bool octave::error_system::m_debug_on_warning
private

TRUE means that Octave will try to enter the debugger when a warning is encountered.

Definition at line 332 of file error.h.

Referenced by debug_on_warning(), interpreter_try(), set_debug_on_warning(), and vwarning().

◆ m_discard_warning_messages

bool octave::error_system::m_discard_warning_messages
private

TRUE means warning messages are turned off.

Definition at line 336 of file error.h.

Referenced by discard_warning_messages(), and set_discard_warning_messages().

◆ m_interpreter

interpreter& octave::error_system::m_interpreter
private

Definition at line 316 of file error.h.

Referenced by throw_error(), and vwarning().

◆ m_last_error_id

std::string octave::error_system::m_last_error_id
private

The last error message id.

Definition at line 367 of file error.h.

Referenced by last_error_id(), and set_last_error_id().

◆ m_last_error_message

std::string octave::error_system::m_last_error_message
private

The text of the last error message.

Definition at line 358 of file error.h.

Referenced by last_error_message(), and set_last_error_message().

◆ m_last_error_stack

octave_map octave::error_system::m_last_error_stack
private

The last file in which an error occurred.

Definition at line 370 of file error.h.

Referenced by last_error_stack(), and set_last_error_stack().

◆ m_last_warning_id

std::string octave::error_system::m_last_warning_id
private

The last warning message id.

Definition at line 364 of file error.h.

Referenced by last_warning_id(), and set_last_warning_id().

◆ m_last_warning_message

std::string octave::error_system::m_last_warning_message
private

The text of the last warning message.

Definition at line 361 of file error.h.

Referenced by last_warning_message(), and set_last_warning_message().

◆ m_quiet_warning

bool octave::error_system::m_quiet_warning
private

TRUE means that Octave will print no warnings, but lastwarn will be updated.

Definition at line 352 of file error.h.

Referenced by quiet_warning(), and set_quiet_warning().

◆ m_verbose_warning

bool octave::error_system::m_verbose_warning
private

TRUE means that Octave will print a verbose warning.

Currently unused.

Definition at line 348 of file error.h.

Referenced by set_verbose_warning(), and verbose_warning().

◆ m_warning_options

octave_map octave::error_system::m_warning_options
private

A structure containing (most of) the current state of warnings.

Definition at line 355 of file error.h.

Referenced by set_warning_options(), and warning_options().


The documentation for this class was generated from the following files: