Starbound/attic/old_tests/stacktrace_test.cpp
2025-03-21 22:23:30 +11:00

31 lines
436 B
C++

#include "StarFormat.hpp"
using namespace Star;
void throwException() {
throw StarException("some exception");
}
void baz() {
throwException();
}
void bar() {
baz();
}
void foo() {
try {
bar();
} catch(std::exception const& e) {
throw StarException("some top-level exception", e);
}
}
int main(int argc, char** argv) {
try {
foo();
} catch(std::exception const& e) {
coutf("%s\n", e.what());
}
}