File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -72,13 +72,17 @@ Error::Error(
7272 *this << util::errinfo_comment (_description);
7373}
7474
75- static std:: optional<Severity> severityFromString (std:: string _severity)
75+ static optional<Severity> severityFromString (string _severity)
7676{
7777 boost::algorithm::to_lower (_severity);
7878
7979 _severity = boost::algorithm::trim_copy (_severity);
8080
81- _severity[ 0 ] = toupper (_severity[ 0 ]);
81+ if ( _severity == formatErrorSeverityLowercase (Severity::Error)) { return Severity::Error; }
8282
83- return std::make_optional<std::string>(_severity).has_value () ? std::optional<std::string>(_severity) : std::nullopt ;
83+ else if (_severity == formatErrorSeverityLowercase (Severity::Warning)) { return Severity::Warning; }
84+
85+ else if (_severity == formatErrorSeverityLowercase (Severity::Info)) { return Severity::Info; }
86+
87+ else return std::make_optional<Severity>(_severity).has_value () ? std::optional<Severity>(_severity) : std::nullopt ;
8488}
Original file line number Diff line number Diff line change @@ -152,6 +152,8 @@ class Error: virtual public util::Exception
152152 return nullptr ;
153153 }
154154
155+ static std::optional<Severity> severityFromString (std::string _severity);
156+
155157 static Severity errorSeverity (Type _type)
156158 {
157159 if (_type == Type::Info)
You can’t perform that action at this time.
0 commit comments