Skip to content

Commit

Permalink
Pull changes from COLMAP
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe committed Feb 5, 2024
1 parent 69d44c8 commit 1bd8159
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions _pyceres/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,17 @@ class LogMessageFatalThrow : public google::LogMessage {
// so we do it here.
delete result.str_;
};
[[noreturn]] ~LogMessageFatalThrow() noexcept(false) {
~LogMessageFatalThrow() noexcept(false) {
Flush();
throw T(prefix_ + message_);
#if defined(__cpp_lib_uncaught_exceptions) && \
(__cpp_lib_uncaught_exceptions >= 201411L)
if (std::uncaught_exceptions() == 0)
#else
if (!std::uncaught_exception())
#endif
{
throw T(prefix_ + message_);
}
};

private:
Expand All @@ -124,7 +132,7 @@ using LogMessageFatalThrowDefault = LogMessageFatalThrow<std::invalid_argument>;
template <typename T>
T ThrowCheckNotNull(const char* file, int line, const char* names, T&& t) {
if (t == nullptr) {
LogMessageFatalThrowDefault(file, line, new std::string(names));
LogMessageFatalThrowDefault(file, line).stream() << names;
}
return std::forward<T>(t);
}
Expand Down

0 comments on commit 1bd8159

Please sign in to comment.