Mike Dodd | 8cfa702 | 2010-11-17 11:12:26 -0800 | [diff] [blame] | 1 | /** |
| 2 | * @file op_exception.cpp |
| 3 | * exception base class |
| 4 | * |
| 5 | * @remark Copyright 2003 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author Philippe Elie |
| 9 | * @author John Levon |
| 10 | */ |
| 11 | |
| 12 | #include <cstring> |
| 13 | |
| 14 | #include "op_exception.h" |
| 15 | |
| 16 | using namespace std; |
| 17 | |
| 18 | op_exception::op_exception(string const & msg) |
| 19 | : |
| 20 | message(msg) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | op_exception::~op_exception() throw() |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | char const * op_exception::what() const throw() |
| 29 | { |
| 30 | return message.c_str(); |
| 31 | } |
| 32 | |
| 33 | |
| 34 | op_fatal_error::op_fatal_error(string const & msg) |
| 35 | : |
| 36 | op_exception(msg) |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | |
| 41 | op_runtime_error::op_runtime_error(string const & msg) |
| 42 | : |
| 43 | runtime_error(msg) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | op_runtime_error::op_runtime_error(string const & msg, int cerrno) |
| 48 | : |
| 49 | runtime_error(msg + "\ncause: " + strerror(cerrno)) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | op_runtime_error::~op_runtime_error() throw() |
| 54 | { |
| 55 | } |