Fix folly::Function under C++17 exception specifier rules
[folly.git] / folly / experimental / exception_tracer / ExceptionStackTraceLib.cpp
index 57f0fd688648664576c2aaf76e3724c4b98a7bcb..cd569b5eced39bb574f6eb12491b93627cfb2303 100644 (file)
@@ -66,16 +66,20 @@ void moveTopException(StackTraceStack& from, StackTraceStack& to) {
 
 struct Initializer {
   Initializer() {
-    registerCxaThrowCallback(
-        [](void*, std::type_info*, void (*)(void*)) { addActiveException(); });
+    registerCxaThrowCallback([](
+        void*, std::type_info*, void (*)(void*)) noexcept {
+      addActiveException();
+    });
 
-    registerCxaBeginCatchCallback(
-        [](void*) { moveTopException(activeExceptions, caughtExceptions); });
+    registerCxaBeginCatchCallback([](void*) noexcept {
+      moveTopException(activeExceptions, caughtExceptions);
+    });
 
-    registerCxaRethrowCallback(
-        []() { moveTopException(caughtExceptions, activeExceptions); });
+    registerCxaRethrowCallback([]() noexcept {
+      moveTopException(caughtExceptions, activeExceptions);
+    });
 
-    registerCxaEndCatchCallback([]() {
+    registerCxaEndCatchCallback([]() noexcept {
       if (invalid) {
         return;
       }
@@ -97,8 +101,9 @@ struct Initializer {
       }
     });
 
-    registerRethrowExceptionCallback(
-        [](std::exception_ptr) { addActiveException(); });
+    registerRethrowExceptionCallback([](std::exception_ptr) noexcept {
+      addActiveException();
+    });
 
     try {
       ::folly::exception_tracer::installHandlers();