From: Helge Norberg Date: Fri, 4 Dec 2015 15:42:52 +0000 (+0100) Subject: Log expected user errors at info instead of error to not pollute the logs with errors... X-Git-Tag: 2.1.0_Beta1~146 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=904ceb69bb72b06fef57af608530658b6a28885a;p=casparcg Log expected user errors at info instead of error to not pollute the logs with errors. For example a CG STOP on a layer where no cg producer is running. --- diff --git a/common/except.h b/common/except.h index 6a52f3530..f4319f6d3 100644 --- a/common/except.h +++ b/common/except.h @@ -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(); diff --git a/protocol/amcp/AMCPCommandQueue.cpp b/protocol/amcp/AMCPCommandQueue.cpp index b49015e99..e1b60b9f8 100644 --- a/protocol/amcp/AMCPCommandQueue.cpp +++ b/protocol/amcp/AMCPCommandQueue.cpp @@ -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); diff --git a/protocol/amcp/AMCPCommandsImpl.cpp b/protocol/amcp/AMCPCommandsImpl.cpp index fb4631f9d..2a377d225 100644 --- a/protocol/amcp/AMCPCommandsImpl.cpp +++ b/protocol/amcp/AMCPCommandsImpl.cpp @@ -994,7 +994,7 @@ spl::shared_ptr 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; }