Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarException_unix.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-25 18:12:54 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-25 18:12:54 +1000
commit7d205330dbf1c2fd44d9d58393ab46434ac8bb5e (patch)
treee73db06236120e2399f0b4863257477eec528295 /source/core/StarException_unix.cpp
parente2424b7dcf60d18b277b092eb7f2a947fff27415 (diff)
More directives optimization
Diffstat (limited to 'source/core/StarException_unix.cpp')
-rw-r--r--source/core/StarException_unix.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/core/StarException_unix.cpp b/source/core/StarException_unix.cpp
index db23c7c..578c0b4 100644
--- a/source/core/StarException_unix.cpp
+++ b/source/core/StarException_unix.cpp
@@ -38,8 +38,8 @@ StarException::StarException() noexcept
StarException::~StarException() noexcept {}
-StarException::StarException(std::string message) noexcept
- : StarException("StarException", move(message)) {}
+StarException::StarException(std::string message, bool genStackTrace) noexcept
+ : StarException("StarException", move(message), genStackTrace) {}
StarException::StarException(std::exception const& cause) noexcept
: StarException("StarException", std::string(), cause) {}
@@ -56,19 +56,19 @@ const char* StarException::what() const throw() {
return m_whatBuffer.c_str();
}
-StarException::StarException(char const* type, std::string message) noexcept {
- auto printException = [](std::ostream& os, bool fullStacktrace, char const* type, std::string message, StackCapture stack) {
+StarException::StarException(char const* type, std::string message, bool genStackTrace) noexcept {
+ auto printException = [](std::ostream& os, bool fullStacktrace, char const* type, std::string message, Maybe<StackCapture> stack) {
os << "(" << type << ")";
if (!message.empty())
os << " " << message;
- if (fullStacktrace) {
+ if (fullStacktrace && stack) {
os << std::endl;
- os << outputStack(stack);
+ os << outputStack(*stack);
}
};
- m_printException = bind(printException, _1, _2, type, move(message), captureStack());
+ m_printException = bind(printException, _1, _2, type, move(message), genStackTrace ? captureStack() : Maybe<StackCapture>());
}
StarException::StarException(char const* type, std::string message, std::exception const& cause) noexcept