class EContractError

Base class for exceptions related to contract theory. More...

Definition#include <contracts.h>
InheritsCustomException
Inherited byEAssertionError, EInvariantError, EPostConditionError, EPreConditionError
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Members


Detailed Description

This is the base class for exceptions related to Meyer's contract theory. EContractError provides a constructor that allows more precise debugging info, such as the line number and the filename from where the error was raised.

EContractError ()

Default constructor. Creates an EContractError object with the message "Contract violation error".

EContractError (const char* fileName, int line, const char* condition,int contract)

Construct a new EContractError object from environment data on the location of the contract violation. This constructor is typically used with __FILE__ and __LINE__ compiler defines. The parameters must not be 0.

Parameters:
fileNameName of the file where the error occured.
lineLine where the error occured.
conditioncondition that failed (in a string format).
contractEither of the following constants: PreCondition, PostCondition, Invariant or Assertion.

QString message ()
[const virtual]

Get the error message of the EContractError object. This method is overloaded to provide meaningful error messages from the values obtained at construction time (file and line of error, condition that was violated, type of contract that was violated).

Returns: QString An error message representing data in the EContractError object.