]> git.sesse.net Git - casparcg/commitdiff
Log context_info exception attachment in addition to msg_info attachment when logging...
authorHelge Norberg <helge.norberg@svt.se>
Wed, 2 Dec 2015 16:33:10 +0000 (17:33 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Wed, 2 Dec 2015 16:33:10 +0000 (17:33 +0100)
common/executor.h
protocol/amcp/AMCPCommandQueue.cpp
shell/main.cpp

index b81bb0187c464f589b3095a71620189b37ceb899..805c1bc9dbe6d080fbd7a418d0cd29dd34fb65a6 100644 (file)
@@ -250,7 +250,17 @@ private:
                                function();
                        }
 
-                       return future.get();
+                       try
+                       {
+                               return future.get();
+                       }
+                       catch (const caspar_exception& e)
+                       {
+                               if (!is_current()) // Add context information from this thread before rethrowing.
+                                       e << context_info(get_context() + *boost::get_error_info<context_info_t>(e));
+
+                               throw;
+                       }
                });
        }
 
index ddfa8c58f5058d53531fcfd23d34342940fe1582..b49015e99f33c49d5d34d1904706df4329d8a8ed 100644 (file)
@@ -108,16 +108,16 @@ void AMCPCommandQueue::AddCommand(AMCPCommand::ptr_type pCurrentCommand)
                                else
                                        CASPAR_LOG(warning) << "Failed to execute command: " << print;
                        }
-                       catch (file_not_found&)
+                       catch (const file_not_found& e)
                        {
                                CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(debug);
-                               CASPAR_LOG(error) << L"File not found. No match found for parameters. Check syntax. Turn on log level debug for stacktrace.";
+                               CASPAR_LOG(error) << get_message_and_context(e) << " Turn on log level debug for stacktrace.";
                                pCurrentCommand->SetReplyString(L"404 " + pCurrentCommand->print() + L" FAILED\r\n");
                        }
                        catch (const user_error& e)
                        {
                                CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(debug);
-                               CASPAR_LOG(error) << *boost::get_error_info<msg_info_t>(e) << ". Check syntax. Turn on log level debug for stacktrace.";
+                               CASPAR_LOG(error) << get_message_and_context(e) << " Check syntax. Turn on log level debug for stacktrace.";
                                pCurrentCommand->SetReplyString(L"403 " + pCurrentCommand->print() + L" FAILED\r\n");
                        }
                        catch (std::out_of_range&)
index 92b370838f0bd39e332e8f31e53e898d37f15af3..5cfbb4d15e195b2dece8cc650096b14837243710 100644 (file)
@@ -332,7 +332,7 @@ int main(int argc, char** argv)
        catch (const user_error& e)
        {
                CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(debug);
-               CASPAR_LOG(fatal) << *boost::get_error_info<msg_info_t>(e) << ". Please check the configuration file (" << u8(config_file_name) << ") for errors. Turn on log level debug for stacktrace.";
+               CASPAR_LOG(fatal) << get_message_and_context(e) << " Please check the configuration file (" << u8(config_file_name) << ") for errors. Turn on log level debug for stacktrace.";
                wait_for_keypress();
        }
        catch(...)