Rev 1947 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1945 | runge | 1 | /* |
| 2 | * |
||
| 3 | * Copyright (C) 2012 Mattias Runge |
||
| 4 | * |
||
| 5 | * This program is free software; you can redistribute it and/or modify |
||
| 6 | * it under the terms of the GNU General Public License as published by |
||
| 7 | * the Free Software Foundation; either version 2 of the License, or |
||
| 8 | * (at your option) any later version. |
||
| 9 | * |
||
| 10 | * This program is distributed in the hope that it will be useful, |
||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 13 | * GNU General Public License for more details. |
||
| 14 | * |
||
| 15 | * You should have received a copy of the GNU General Public License along |
||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
| 18 | * |
||
| 19 | */ |
||
| 20 | |||
| 21 | #ifndef EXCEPTION_H |
||
| 22 | #define EXCEPTION_H |
||
| 23 | |||
| 24 | #include <iostream> |
||
| 25 | #include <stdexcept> |
||
| 26 | #include <exception> |
||
| 27 | #include <stdio.h> |
||
| 28 | #include <stdint.h> |
||
| 29 | |||
| 30 | namespace atom { |
||
| 31 | namespace exception { |
||
| 32 | |||
| 33 | #define CREATE_EXCEPTION(name, string) \ |
||
| 1989 | runge | 34 | class name : public std::exception \ |
| 1945 | runge | 35 | { \ |
| 36 | virtual const char* what() const throw() \ |
||
| 37 | { \ |
||
| 1989 | runge | 38 | return string; \ |
| 1945 | runge | 39 | } \ |
| 1947 | runge | 40 | }; |
| 1945 | runge | 41 | |
| 42 | |||
| 43 | CREATE_EXCEPTION(invalid_in_param, "Inparameter failure"); |
||
| 44 | CREATE_EXCEPTION(missing_in_param, "Missing inparameters"); |
||
| 45 | CREATE_EXCEPTION(connect_failed, "Connection failed"); |
||
| 46 | CREATE_EXCEPTION(initialization_failed, "Initialization failed"); |
||
| 47 | CREATE_EXCEPTION(missing_resource, "Missing resource"); |
||
| 48 | CREATE_EXCEPTION(action_failed, "Action failed"); |
||
| 1947 | runge | 49 | CREATE_EXCEPTION(unknown_state, "Unrecognized state"); |
| 1989 | runge | 50 | CREATE_EXCEPTION(parsing_failed, "Parsing failed"); |
| 1945 | runge | 51 | |
| 52 | |||
| 53 | }; // namespace exception |
||
| 54 | }; // namespace atom |
||
| 55 | |||
| 56 | #endif // EXCEPTION_H |
||
| 57 |