log messages to message container.
This commit is contained in:
@@ -77,15 +77,20 @@ namespace Opm {
|
||||
|
||||
Message::type ParseContext::handleError(
|
||||
const std::string& errorKey,
|
||||
MessageContainer& msgContainer,
|
||||
const std::string& msg ) const {
|
||||
|
||||
InputError::Action action = get( errorKey );
|
||||
|
||||
if (action == InputError::WARN)
|
||||
if (action == InputError::WARN) {
|
||||
msgContainer.warning(msg);
|
||||
return Message::Warning;
|
||||
}
|
||||
|
||||
else if (action == InputError::THROW_EXCEPTION)
|
||||
else if (action == InputError::THROW_EXCEPTION) {
|
||||
msgContainer.error(msg);
|
||||
throw std::invalid_argument(errorKey + ": " + msg);
|
||||
}
|
||||
|
||||
return Message::Debug;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Opm {
|
||||
public:
|
||||
ParseContext();
|
||||
ParseContext(const std::vector<std::pair<std::string , InputError::Action>> initial);
|
||||
Message::type handleError( const std::string& errorKey, const std::string& msg ) const;
|
||||
Message::type handleError( const std::string& errorKey, MessageContainer& msgContainer, const std::string& msg ) const;
|
||||
bool hasKey(const std::string& key) const;
|
||||
ParseContext withKey(const std::string& key, InputError::Action action = InputError::WARN) const;
|
||||
ParseContext& withKey(const std::string& key, InputError::Action action = InputError::WARN);
|
||||
|
||||
Reference in New Issue
Block a user