]> git.sesse.net Git - casparcg/commitdiff
Log expected user errors at info instead of error to not pollute the logs with errors...
authorHelge Norberg <helge.norberg@svt.se>
Fri, 4 Dec 2015 15:42:52 +0000 (16:42 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Fri, 4 Dec 2015 15:42:52 +0000 (16:42 +0100)
common/except.h
protocol/amcp/AMCPCommandQueue.cpp
protocol/amcp/AMCPCommandsImpl.cpp

index 6a52f3530a237b79bc5539e66c2220a125785392..f4319f6d3dd5108584d8f01218c3b5bfa6fef89a 100644 (file)
@@ -92,6 +92,7 @@ struct timed_out                              : virtual caspar_exception {};
 struct not_implemented                 : virtual caspar_exception {};
 
 struct user_error                              : virtual caspar_exception {};
+struct expected_user_error             : virtual user_error {};
 struct not_supported                   : virtual user_error {};
 
 std::string get_context();
index b49015e99f33c49d5d34d1904706df4329d8a8ed..e1b60b9f85e869e35aa7fcf1ba946dfdd18a53d3 100644 (file)
@@ -114,6 +114,12 @@ void AMCPCommandQueue::AddCommand(AMCPCommand::ptr_type pCurrentCommand)
                                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 expected_user_error& e)
+                       {
+                               CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(debug);
+                               CASPAR_LOG(info) << 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 (const user_error& e)
                        {
                                CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(debug);
index fb4631f9d388836282ff93e5fcc9febeb966796f..2a377d225908cd7cb9133b027c685ee20ab97d3c 100644 (file)
@@ -994,7 +994,7 @@ spl::shared_ptr<core::cg_proxy> get_expected_cg_proxy(command_context& ctx)
        auto proxy = ctx.cg_registry->get_proxy(spl::make_shared_ptr(ctx.channel.channel), ctx.layer_index(core::cg_proxy::DEFAULT_LAYER));
 
        if (proxy == cg_proxy::empty())
-               CASPAR_THROW_EXCEPTION(user_error() << msg_info(L"No CG proxy running on layer"));
+               CASPAR_THROW_EXCEPTION(expected_user_error() << msg_info(L"No CG proxy running on layer"));
 
        return proxy;
 }