const auto &rules = consumed_blocks->get_blocks_or_empty();
if (rules.empty()) {
- if (error.type == css_parse_error_type::PARSE_ERROR_UNKNOWN_ERROR) {
+ if (error.type == css_parse_error_type::PARSE_ERROR_NO_ERROR) {
return css_parse_error(css_parse_error_type::PARSE_ERROR_EMPTY,
"no css rules consumed");
}
PARSE_ERROR_UNKNOWN_OPTION,
PARSE_ERROR_INVALID_SYNTAX,
PARSE_ERROR_BAD_NESTING,
- PARSE_ERROR_EMPTY,
PARSE_ERROR_NYI,
PARSE_ERROR_UNKNOWN_ERROR,
+ /* All above is treated as fatal error in parsing */
PARSE_ERROR_NO_ERROR,
+ PARSE_ERROR_EMPTY,
};
struct css_parse_error {
type(type), description(description) {}
explicit css_parse_error (css_parse_error_type type = css_parse_error_type::PARSE_ERROR_NO_ERROR) :
type(type) {}
+
+ constexpr auto is_fatal(void) const -> bool {
+ return type < css_parse_error_type::PARSE_ERROR_NO_ERROR;
+ }
};
}
std::move(hc->css_style));
if (!ret_maybe.has_value()) {
- auto err_str = fmt::format("cannot parse css (error code: {}): {}",
- static_cast<int>(ret_maybe.error().type),
- ret_maybe.error().description.value_or("unknown error"));
- msg_info_pool ("cannot parse css: %*s",
- (int) err_str.size(), err_str.data());
+ if (ret_maybe.error().is_fatal()) {
+ auto err_str = fmt::format(
+ "cannot parse css (error code: {}): {}",
+ static_cast<int>(ret_maybe.error().type),
+ ret_maybe.error().description.value_or("unknown error"));
+ msg_info_pool ("cannot parse css: %*s",
+ (int) err_str.size(), err_str.data());
+ }
}
else {
hc->css_style = ret_maybe.value();