]> git.hungrycats.org Git - bees/commitdiff
crucible: error: record location of exception in what() message
authorZygo Blaxell <bees@furryterror.org>
Sun, 8 Jul 2018 00:17:24 +0000 (20:17 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 15 Sep 2018 03:49:51 +0000 (23:49 -0400)
Make the log show where the exception is thrown from.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
include/crucible/error.h

index 170b5ba2b45c7dbf09cbcad285ee2db4e5d198d8..1cfc0fa0865bf2203dd9325aec104d6599eeab0c 100644 (file)
@@ -81,21 +81,21 @@ namespace crucible {
 // macro for throwing an error
 #define THROW_ERROR(type, expr) do { \
        std::ostringstream _te_oss; \
-       _te_oss << expr; \
+       _te_oss << expr << " at " << __FILE__ << ":" << __LINE__; \
        throw type(_te_oss.str()); \
 } while (0)
 
 // macro for throwing a system_error with errno
 #define THROW_ERRNO(expr) do { \
        std::ostringstream _te_oss; \
-       _te_oss << expr; \
+       _te_oss << expr << " at " << __FILE__ << ":" << __LINE__; \
        throw std::system_error(std::error_code(errno, std::system_category()), _te_oss.str()); \
 } while (0)
 
 // macro for throwing a system_error with some other variable
 #define THROW_ERRNO_VALUE(value, expr) do { \
        std::ostringstream _te_oss; \
-       _te_oss << expr; \
+       _te_oss << expr << " at " << __FILE__ << ":" << __LINE__; \
        throw std::system_error(std::error_code((value), std::system_category()), _te_oss.str()); \
 } while (0)