From 611bf03b0a182a9585007976e5fdd51c0999cb66 Mon Sep 17 00:00:00 2001 From: Konstantina Skovola <konstantina.skovola@cern.ch> Date: Fri, 10 May 2024 17:08:30 +0200 Subject: [PATCH] Set UserError log level to INFO Change the behavior of UserError, having it logged at INFO level instead of ERROR level. Also, throw UserError instead of Exception for the `tape ls --state` subcommand. --- common/dataStructures/Tape.cpp | 4 ++-- xroot_plugins/XrdSsiCtaRequestProc.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/dataStructures/Tape.cpp b/common/dataStructures/Tape.cpp index c3e6119dcb..3eccc11538 100644 --- a/common/dataStructures/Tape.cpp +++ b/common/dataStructures/Tape.cpp @@ -17,7 +17,7 @@ #include "common/dataStructures/Tape.hpp" #include "common/dataStructures/utils.hpp" -#include "common/exception/Exception.hpp" +#include "common/exception/UserError.hpp" #include "common/utils/utils.hpp" namespace cta::common::dataStructures { @@ -129,7 +129,7 @@ Tape::State Tape::stringToState(const std::string& stateStr, bool hidePendingSta try { return Tape::STRING_TO_STATE_MAP.at(stateUpperCase); } catch(std::out_of_range &ex){ - throw cta::exception::Exception(std::string("The state given (") + stateUpperCase + ") does not exist. Possible values are " + Tape::getAllPossibleStates(hidePendingStates)); + throw cta::exception::UserError(std::string("The state given (") + stateUpperCase + ") does not exist. Possible values are " + Tape::getAllPossibleStates(hidePendingStates)); } } diff --git a/xroot_plugins/XrdSsiCtaRequestProc.cpp b/xroot_plugins/XrdSsiCtaRequestProc.cpp index 7eff401642..a9ccf42473 100644 --- a/xroot_plugins/XrdSsiCtaRequestProc.cpp +++ b/xroot_plugins/XrdSsiCtaRequestProc.cpp @@ -80,7 +80,7 @@ void RequestProc<cta::xrd::Request, cta::xrd::Response, cta::xrd::Alert>::Execut } catch(cta::exception::UserError &ex) { m_metadata.set_type(cta::xrd::Response::RSP_ERR_USER); m_metadata.set_message_txt(ex.getMessageValue()); - lc.log(cta::log::ERR, ErrorFunction + "RSP_ERR_USER: " + ex.getMessageValue()); + lc.log(cta::log::INFO, ErrorFunction + "RSP_ERR_USER: " + ex.getMessageValue()); } catch(cta::exception::Exception &ex) { m_metadata.set_type(cta::xrd::Response::RSP_ERR_CTA); m_metadata.set_message_txt(ex.getMessageValue()); -- GitLab