css_parser(void) = delete; /* Require mempool to be set for logging */
explicit css_parser(rspamd_mempool_t *pool) : pool (pool) {
style_object.reset();
+ error.type = css_parse_error_type::PARSE_ERROR_NO_ERROR;
}
/*
* destruct it on errors (we assume that it is owned somewhere else)
*/
explicit css_parser(std::shared_ptr<css_style_sheet> &&existing, rspamd_mempool_t *pool) :
- style_object(existing), pool(pool) {}
+ style_object(existing), pool(pool) {
+ error.type = css_parse_error_type::PARSE_ERROR_NO_ERROR;
+ }
/*
* Process input css blocks
if (++rec_level > max_rec) {
msg_err_css("max nesting reached, ignore style");
- error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING);
+ error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING,
+ "maximum nesting has reached when parsing function value");
return false;
}
if (!consume_current && ++rec_level > max_rec) {
msg_err_css("max nesting reached, ignore style");
- error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING);
+ error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING,
+ "maximum nesting has reached when parsing simple block value");
return false;
}
if (++rec_level > max_rec) {
msg_err_css("max nesting reached, ignore style");
- error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING);
+ error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING,
+ "maximum nesting has reached when parsing qualified rule value");
return false;
}
if (++rec_level > max_rec) {
msg_err_css("max nesting reached, ignore style");
- error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING);
+ error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING,
+ "maximum nesting has reached when parsing at keyword");
return false;
}
top->token_type_str(), rec_level);
if (++rec_level > max_rec) {
- error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING);
+ error = css_parse_error(css_parse_error_type::PARSE_ERROR_BAD_NESTING,
+ "maximum nesting has reached when parsing component value");
return false;
}