CBMC
cprover_exception_baset Class Reference

Base class for exceptions thrown in the cprover project. More...

#include <c_errors.h>

+ Inheritance diagram for cprover_exception_baset:
+ Collaboration diagram for cprover_exception_baset:

Public Member Functions

virtual std::string what () const
 A human readable description of what went wrong. More...
 
virtual ~cprover_exception_baset ()=default
 
virtual std::string what () const
 A human readable description of what went wrong. More...
 
virtual ~cprover_exception_baset ()=default
 

Protected Member Functions

 cprover_exception_baset (std::string reason)
 This constructor is marked protected to ensure this class isn't used directly. More...
 
 cprover_exception_baset (std::string reason)
 This constructor is marked protected to ensure this class isn't used directly. More...
 

Protected Attributes

std::string reason
 The reason this exception was generated. More...
 

Detailed Description

Base class for exceptions thrown in the cprover project.

Intended to be used as a convenient way to have a "catch all and report errors" from application entry points. Note that the reason we use a custom base class as opposed to std::exception or one of its derivates to avoid them being accidentally caught by code expecting standard exceptions to be only thrown by the standard library.

Definition at line 63 of file c_errors.h.

Constructor & Destructor Documentation

◆ ~cprover_exception_baset() [1/2]

virtual cprover_exception_baset::~cprover_exception_baset ( )
virtualdefault

◆ cprover_exception_baset() [1/2]

cprover_exception_baset::cprover_exception_baset ( std::string  reason)
inlineexplicitprotected

This constructor is marked protected to ensure this class isn't used directly.

Deriving classes should be used to more precisely describe the problem that occurred.

Definition at line 76 of file c_errors.h.

◆ ~cprover_exception_baset() [2/2]

virtual cprover_exception_baset::~cprover_exception_baset ( )
virtualdefault

◆ cprover_exception_baset() [2/2]

cprover_exception_baset::cprover_exception_baset ( std::string  reason)
inlineexplicitprotected

This constructor is marked protected to ensure this class isn't used directly.

Deriving classes should be used to more precisely describe the problem that occurred.

Definition at line 37 of file exception_utils.h.

Member Function Documentation

◆ what() [1/2]

std::string cprover_exception_baset::what ( ) const
virtual

A human readable description of what went wrong.

For readability, implementors should not add a leading or trailing newline to this description.

Reimplemented in invalid_source_file_exceptiont, incorrect_goto_program_exceptiont, invalid_command_line_argument_exceptiont, invalid_restriction_exceptiont, and invalid_function_contract_pair_exceptiont.

Definition at line 12 of file exception_utils.cpp.

◆ what() [2/2]

virtual std::string cprover_exception_baset::what ( ) const
virtual

A human readable description of what went wrong.

For readability, implementors should not add a leading or trailing newline to this description.

Reimplemented in invalid_source_file_exceptiont, incorrect_goto_program_exceptiont, invalid_command_line_argument_exceptiont, invalid_restriction_exceptiont, and invalid_function_contract_pair_exceptiont.

Member Data Documentation

◆ reason

std::string cprover_exception_baset::reason
protected

The reason this exception was generated.

This is the string returned by what() unless that method is overridden

Definition at line 83 of file c_errors.h.


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