World Ocean Simulation System (WOSS) library
woss::WossException Class Reference

Exception thrown by the Woss test framework. More...

#include <woss-test.h>

Inheritance diagram for woss::WossException:
Inheritance graph
Collaboration diagram for woss::WossException:
Collaboration graph

Public Member Functions

 WossException (WossErrorType error_type_, const char *file_, int line_, const char *func_, const char *info_)
 WossException (const WossException &copy)=default
virtual ~WossException () override throw () =default
WossExceptionoperator= (const WossException &copy)=default
virtual const char * what () const throw ()
WossErrorType getErrorType () const
const char * getFile () const
int getLine () const
const char * getFunc () const
const char * getInfo () const

Static Public Member Functions

static void printAndExit (const std::exception *e)

Static Public Attributes

static constexpr int CHAR_ARR_LENGTH = 250

Protected Attributes

WossErrorType error_type
char file [CHAR_ARR_LENGTH]
int line
char func [CHAR_ARR_LENGTH]
char info [CHAR_ARR_LENGTH]
char what_str [4 *CHAR_ARR_LENGTH]

Detailed Description

Exception thrown by the Woss test framework.

WossException class stores the file, the line and the type of the thrown exception

Constructor & Destructor Documentation

◆ WossException() [1/2]

WossException::WossException ( WossErrorType error_type_,
const char * file_,
int line_,
const char * func_,
const char * info_ )

WossException constructor

Parameters
error_type_error type
file_file where the exception has been thrown
line_line where the exception has been thrown
func_function name where the exception has been thrown
info_additional info c string

References error_type, file, func, info, line, and what_str.

Referenced by operator=(), printAndExit(), and WossException().

◆ WossException() [2/2]

woss::WossException::WossException ( const WossException & copy)
default

copy constructor

References WossException().

Here is the call graph for this function:

◆ ~WossException()

virtual woss::WossException::~WossException ( )
throw ( )
overridevirtualdefault

destructor

Member Function Documentation

◆ getErrorType()

WossErrorType woss::WossException::getErrorType ( ) const
inline

Get current error type

Returns
the current WossErrorType

References error_type, and getErrorType().

Referenced by getErrorType(), printAndExit(), and WossUnitTest::testExceptions().

Here is the call graph for this function:

◆ getFile()

const char * woss::WossException::getFile ( ) const
inline

Get current file c string

Returns
const char*

References file.

◆ getFunc()

const char * woss::WossException::getFunc ( ) const
inline

Get current function c string

Returns
const char*

References func.

◆ getInfo()

const char * woss::WossException::getInfo ( ) const
inline

Get current info c string

Returns
const char*

References info.

Referenced by WossUnitTest::testExceptions().

◆ getLine()

int woss::WossException::getLine ( ) const
inline

Get current line

Returns
the current line

References line.

◆ operator=()

WossException & woss::WossException::operator= ( const WossException & copy)
default

assignement operator

Parameters
copythe source copy

References what(), and WossException().

Here is the call graph for this function:

◆ printAndExit()

void WossException::printAndExit ( const std::exception * e)
static

Function that print the current exception and exit the test

Parameters
einput exception

References getErrorType(), woss::WOSS_ERROR_UNEXPECTED_EXCEPTION, and WossException().

Referenced by woss::WossTest::run().

Here is the call graph for this function:

◆ what()

const char * WossException::what ( ) const
throw ( )
virtual

inherited from base class

Returns
a c-string description

References error_type, file, func, info, line, and what_str.

Referenced by operator=().

Member Data Documentation

◆ CHAR_ARR_LENGTH

int woss::WossException::CHAR_ARR_LENGTH = 250
inlinestaticconstexpr

Max length of all char arrays

◆ error_type

WossErrorType woss::WossException::error_type
protected

current error type

Referenced by getErrorType(), what(), and WossException().

◆ file

char woss::WossException::file[CHAR_ARR_LENGTH]
protected

current file c string

Referenced by getFile(), what(), and WossException().

◆ func

char woss::WossException::func[CHAR_ARR_LENGTH]
protected

current function c string

Referenced by getFunc(), what(), and WossException().

◆ info

char woss::WossException::info[CHAR_ARR_LENGTH]
protected

current info c string

Referenced by getInfo(), what(), and WossException().

◆ line

int woss::WossException::line
protected

current line

Referenced by getLine(), what(), and WossException().

◆ what_str

char woss::WossException::what_str[4 *CHAR_ARR_LENGTH]
protected

current what c string

Referenced by what(), and WossException().


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