# Hurricane VLSI Database

List of all members | Public Member Functions
Hurricane::Error Class Reference

Error description (API) More...

Inheritance diagram for Hurricane::Error:
[legend]

## Public Member Functions
| Error (const string &reason)
| Error (const char *format,...)
| Error (int code, const string &reason)
| Error (int code, const char *format,...)
| Error (const Error &error)
string | getReason () const
int | getCode () const
string | textWhere () const
string | htmlWhere () const
Public Member Functions inherited from Hurricane::Exception
string | what () const
string | textWhat () const
string | htmlWhat () const

## Additional Inherited Members
Static Public Member Functions inherited from Hurricane::Exception
static void | setTextTranslator (const TextTranslator &translator)
static void | setHtmlTranslator (const TextTranslator &translator)

## Detailed Description

Error description (API)

# Printing format

Errors are printed with different formats wether the error code is null or not : text: So the following code :

try {
throw Error("Something strange");
}
catch {Exception& exception) {
cerr << exception.what() << endl;
}

Will produce the message :

[ERROR] Something strange

while the following code :

try {
throw Error(3, "Can't create Net : null cell");
}
catch {Exception& exception) {
cerr << exception.what() << endl;
}

Will produce the message :

[ERROR:3] Can't create Net : null cell

You can always print something different as shown in the following code :

try {
throw Error(3, "Can't create Net : null cell");
}
catch {Error& error) {
cerr << error.getReason() << " (code " << error.getCode() << ")" << endl;
}
catch {Exception& exception) {
cerr << exception.what() << endl;
}

Which will produce the message :

Can't create Net : null cell (code 3)

## Constructor & Destructor Documentation

## ◆ Error() [1/5]

Hurricane::Error::Error | ( | const string & | reason | ) |

Builds a error characterized by a reason (code defaults to zero).

## ◆ Error() [2/5]

Hurricane::Error::Error | ( | const char * | format,
|  |  | ...
| ) |  |

Builds a error characterized by a reason, using the `vararg` protocol and `printf` format (code defaults to zero).

## ◆ Error() [3/5]

Hurricane::Error::Error | ( | int | code,
|  | const string & | reason
| ) |  |

Builds a error characterized by a reason and a code useful within a switch.

## ◆ Error() [4/5]

Hurricane::Error::Error | ( | int | code,
|  | const char * | format,
|  |  | ...
| ) |  |

Builds a error characterized by a reason and a code useful within a switch. The reason is supplied in a `printf` like fashion.

## ◆ Error() [5/5]

Hurricane::Error::Error | ( | const Error & | error | ) |

Copy constructor.

## Member Function Documentation

## ◆ getReason()

string Hurricane::Error::getReason | ( |  | ) | const
| inline

Returns: the reason for which the error was thrown.

## ◆ getCode()

int Hurricane::Error::getCode | ( |  | ) | const
| inline

Returns: the error code number.

## ◆ textWhere()

string Hurricane::Error::textWhere | ( |  | ) | const
| inline

Returns: A stack trace, suitable for tty.

## ◆ htmlWhere()

string Hurricane::Error::htmlWhere | ( |  | ) | const
| inline

Returns: A stack trace, suitable for HTML.

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

- Error.h
- Error.dox

Generated by doxygen 1.8.14 on Tue Jul 21 2020 | Return to top of page

Hurricane VLSI Database | Copyright © 2000-2016 Bull S.A. All rights reserved