summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-26 12:52:20 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-26 14:36:30 +0200
commitbc307f6b1c51dad288d51c7ac4475c876ceaf417 (patch)
treec2a9d02b4b85274e4f619ced97465a61f2a0a847 /Libraries
parent602c3fdb3a0975418886e32cf9cc53b45d2f8964 (diff)
downloadserenity-bc307f6b1c51dad288d51c7ac4475c876ceaf417.zip
LibJS: Only log exception throw information on Serenity
This is a bit annoying when running the js REPL as part of the Lagom build, as it prints the error twice to the same terminal - once from dbg() and then from printf(). Long term this should probably be removed completely and each program take care itself of printing stacktraces to an appropriate location.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibJS/Interpreter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibJS/Interpreter.cpp b/Libraries/LibJS/Interpreter.cpp
index 311743a60f..efee9b940a 100644
--- a/Libraries/LibJS/Interpreter.cpp
+++ b/Libraries/LibJS/Interpreter.cpp
@@ -239,6 +239,7 @@ Value Interpreter::construct(Function& function, Function& new_target, Optional<
Value Interpreter::throw_exception(Exception* exception)
{
+#ifdef __serenity__
if (exception->value().is_object() && exception->value().as_object().is_error()) {
auto& error = static_cast<Error&>(exception->value().as_object());
dbg() << "Throwing JavaScript Error: " << error.name() << ", " << error.message();
@@ -250,6 +251,7 @@ Value Interpreter::throw_exception(Exception* exception)
dbg() << " " << function_name;
}
}
+#endif
m_exception = exception;
unwind(ScopeType::Try);
return {};