KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
kjb::Runtime_error Class Reference

Object thrown when computation fails somehow during execution. More...

#include <l_exception.h>

Inheritance diagram for kjb::Runtime_error:
kjb::Exception kjb::Divide_by_zero kjb::Illegal_argument kjb::Resource_exhaustion kjb::Serialization_error kjb::Stack_overflow kjb::Stack_underflow kjb::Dimension_mismatch kjb::Index_out_of_bounds

Public Member Functions

 Runtime_error (const char *file, unsigned line)
 Constructs a runtime exception. More...
 
 Runtime_error (const char *msg, const char *file=0, unsigned line=0)
 Constructs a runtime exception. More...
 
 Runtime_error (const std::string &msg, const char *file=0, unsigned line=0)
 Constructs a runtime exception. More...
 
virtual ~Runtime_error () throw ()
 Deletes a Runtime_error. More...
 
- Public Member Functions inherited from kjb::Exception
 Exception (const char *msg, const char *file=0, unsigned line=0)
 Constructs an Exception. More...
 
 Exception (const std::string &msg, const char *file=0, unsigned line=0)
 Constructs an Exception. More...
 
 Exception (const Exception &e)
 Constructs an Exception from another. More...
 
virtual ~Exception () throw ()
 Deletes an Exception. More...
 
const std::string & get_msg () const throw ()
 Returns the error message for the Exception. More...
 
const char * what () const throw ()
 Returns the error message for the Exception. More...
 
const char * get_file () const
 Returns the file name where the Exception occurred. More...
 
unsigned get_line () const
 Returns the line number near where the Exception occurred. More...
 
std::string get_details () const
 Return string containing filename, line number, and message. More...
 
virtual void print (std::ostream &out, bool newline=false) const
 Prints the Exception::msg to an ostream. More...
 
virtual void print () const
 
virtual void print_details (std::ostream &out, bool newline=false) const
 Prints all the fields of the Exception to an ostream. More...
 
virtual void print_details () const
 
virtual void print_abort (std::ostream &out, bool newline=false) const
 Prints the Exception::msg to an ostream and aborts. More...
 
virtual void print_abort () const
 
virtual void print_details_abort (std::ostream &out, bool newline=false) const
 Prints all the fields of the Exception to an ostream and aborts. More...
 
virtual void print_details_abort () const
 
virtual void print_exit (std::ostream &out, bool newline, int status=false) const
 Prints the Exception::msg to an ostream and exits. More...
 
virtual void print_exit () const
 
virtual void print_details_exit (std::ostream &out, bool newline=false, int status=EXIT_FAILURE) const
 Prints all the fields of the Exception to an ostream and exits. More...
 
virtual void print_details_exit () const
 

Additional Inherited Members

- Protected Attributes inherited from kjb::Exception
std::string m_msg
 Message associated with the error causing the exception. More...
 
const char * m_file
 File name where the Error occurred. More...
 
unsigned m_line
 Line number where the Error occurred. More...
 

Detailed Description

Object thrown when computation fails somehow during execution.

This class is primarily meant to be a base class to other exceptions.

In a sense, all thrown exceptions represent a run-time condition, because you cannot throw before your program is running, or after it is running. However, sometimes we think of certain tasks as central to a computation (such as linear algebra, fourier transforms, etc.) and other tasks as ancillary (such as option-parsing, filesystem IO, or execution as mediated by macros like KJB_HAVE_LAPACK). Failures in the "central" computational tasks of a program are represented by throwing Runtime_error objects, preferably more-specialized descendant classes than this base class.

Constructor & Destructor Documentation

kjb::Runtime_error::Runtime_error ( const char *  file,
unsigned  line 
)

Constructs a runtime exception.

Parameters
fileFile where the error occurred.
lineLine approximately where the error occurred.
kjb::Runtime_error::Runtime_error ( const char *  msg,
const char *  file = 0,
unsigned  line = 0 
)

Constructs a runtime exception.

Parameters
msgError message.
fileFile where the error occurred.
lineLine approximately where the error occurred.
kjb::Runtime_error::Runtime_error ( const std::string &  msg,
const char *  file = 0,
unsigned  line = 0 
)

Constructs a runtime exception.

Parameters
msgError message.
fileFile where the error occurred.
lineLine approximately where the error occurred.
virtual kjb::Runtime_error::~Runtime_error ( )
throw (
)
inlinevirtual

Deletes a Runtime_error.


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