Nearly CC
An educational compiler skeleton
Public Member Functions | Static Public Member Functions | List of all members
RuntimeError Class Reference

Exception type for general runtime errors that aren't associated with source code. More...

#include "exceptions.h"

Inheritance diagram for RuntimeError:
Inheritance graph
[legend]
Collaboration diagram for RuntimeError:
Collaboration graph
[legend]

Public Member Functions

 RuntimeError (const std::string &desc)
 Constuctor. More...
 
 RuntimeError (const RuntimeError &other)
 Copy constructor. More...
 
bool has_location () const
 Check whether this exception has a valud source Location. More...
 
const Locationget_loc () const
 Get the source Location. More...
 

Static Public Member Functions

static void raise (const char *fmt,...) RT_PRINTF_FORMAT
 Throw a RuntimeError exception. More...
 

Detailed Description

Exception type for general runtime errors that aren't associated with source code.

Constructor & Destructor Documentation

◆ RuntimeError() [1/2]

RuntimeError::RuntimeError ( const std::string &  desc)

Constuctor.

Parameters
descdescription of the error

◆ RuntimeError() [2/2]

RuntimeError::RuntimeError ( const RuntimeError other)

Copy constructor.

Parameters
RuntimeErrorobject to copy from

Member Function Documentation

◆ get_loc()

const Location & BaseException::get_loc ( ) const
inherited

Get the source Location.

Returns
the source Location

◆ has_location()

bool BaseException::has_location ( ) const
inlineinherited

Check whether this exception has a valud source Location.

Returns
true if this exception has a valid source Location, false otherwise

◆ raise()

void RuntimeError::raise ( const char *  fmt,
  ... 
)
static

Throw a RuntimeError exception.

The description is generated from printf-style formatting.

Parameters
fmtthe format string
...argument values (corresponding to conversions in the format string)

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