src/TryCatch.h
raw| 1 | #ifndef FREEBAYES_TRYCATCH_H |
| 2 | #define FREEBAYES_TRYCATCH_H |
| 3 | |
| 4 | #include <stdexcept> // out_of_range exception |
| 5 | #include <stdlib.h> // abort |
| 6 | |
| 7 | // macros which improve our error handling |
| 8 | #ifndef TRY |
| 9 | #define TRY try |
| 10 | #endif |
| 11 | #ifndef CATCH |
| 12 | #define CATCH \ |
| 13 | catch (const std::out_of_range& outOfRange) { \ |
| 14 | cerr << "exception: " << outOfRange.what() \ |
| 15 | << " at line " << __LINE__ \ |
| 16 | << " in file " << __FILE__ << endl; \ |
| 17 | abort(); \ |
| 18 | } |
| 19 | #endif |
| 20 | |
| 21 | #endif |