Skip to content

Commit e820178

Browse files
committed
fix: disable stacktrace if not avail
1 parent 7dddd14 commit e820178

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/module.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@
99
#include <plg/string.hpp>
1010
#include <plg/numerics.hpp>
1111

12-
#include <stacktrace>
1312
#include <plugify/assembly_loader.hpp>
1413

14+
#if __has_include(<stacktrace>)
15+
#include <stacktrace>
16+
#define HAS_STACKTRACE 1
17+
#else
18+
#define HAS_STACKTRACE 0
19+
#endif
20+
1521
#define LOG_PREFIX "[GOLM] "
1622

1723
using namespace golm;
@@ -265,9 +271,10 @@ const char* GetCacheDir() {
265271
void PrintException(GoString message) {
266272
if (const auto& provider = g_golm.GetProvider()) {
267273
provider->Log(std::format(LOG_PREFIX "[Exception] {}", std::string_view(message)), Severity::Error);
268-
274+
#if HAS_STACKTRACE
269275
auto trace = std::stacktrace::current();
270276
provider->Log(std::to_string(trace), Severity::Error);
277+
#endif
271278
}
272279
}
273280

0 commit comments

Comments
 (0)