Skip to content

Commit

Permalink
cleanup: clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
umegane committed Sep 25, 2024
1 parent 1909d09 commit e316186
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/limestone/limestone_exception_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,34 @@ inline std::string extract_filename(const std::string& path) {
return p.filename().string();
}

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define THROW_LIMESTONE_EXCEPTION(message) \
{ \
LOG_LP(ERROR) << message; \
throw limestone_exception(std::string(message) + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")"); \
LOG_LP(ERROR) << (message); \
throw limestone_exception(std::string((message)) + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")"); \
}

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define THROW_LIMESTONE_IO_EXCEPTION(message, error_code) \
{ \
std::string full_message = limestone_io_exception::format_message(message, error_code); \
std::string full_message = limestone_io_exception::format_message((message), (error_code)); \
LOG_LP(ERROR) << full_message; \
throw limestone_io_exception(full_message + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")", error_code); \
throw limestone_io_exception(full_message + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")", (error_code)); \
}

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define LOG_AND_THROW_EXCEPTION(message) \
{ \
LOG_LP(ERROR) << message; \
throw limestone_exception(std::string(message) + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")"); \
LOG_LP(ERROR) << (message); \
throw limestone_exception(std::string((message)) + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")"); \
}

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define LOG_AND_THROW_IO_EXCEPTION(message, error_code) \
{ \
std::string full_message = limestone_io_exception::format_message(message, error_code); \
std::string full_message = limestone_io_exception::format_message((message), (error_code)); \
LOG_LP(ERROR) << full_message; \
throw limestone_io_exception(full_message + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")", error_code); \
throw limestone_io_exception(full_message + " (at " + extract_filename(__FILE__) + ":" + std::to_string(__LINE__) + ")", (error_code)); \
}


Expand Down

0 comments on commit e316186

Please sign in to comment.