Commit 292914ed authored by jan.koester's avatar jan.koester
Browse files

test

parent 4e3c260b
Loading
Loading
Loading
Loading
+17 −0
Changes for editor/src/webedit_api.cpp: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5987,7 +5987,24 @@ std::string webedit::Api::renderTree(const blogi::webedit::EditPlugin *node, con
    libhtmlpp::HtmlElement wrapper("div");
    auto *el = node;
    while (el) {
        // A single widget's Render() throwing (e.g. libhtmlpp::HtmlElement::
        // setAttribute rejects any literal '"' in an attribute value with no
        // escaping, just an outright exception -- easy to hit via imported
        // content that ends up embedded in a style="..." string) must not
        // take down preview/publish for the WHOLE document -- both call this
        // with no try/catch of their own, so an uncaught exception here
        // propagates all the way to the generic HTTP request handler and
        // comes back as a bare "Internal server error", discarding
        // everything else on the page along with it. Render is const, so
        // skipping this one top-level element leaves every sibling
        // unaffected.
        try {
            el->Render(wrapper);
        } catch (const std::exception &e) {
            std::cerr << "renderTree: widget Render() failed, skipping: " << e.what() << std::endl;
        } catch (...) {
            std::cerr << "renderTree: widget Render() failed, skipping (unknown exception)" << std::endl;
        }
        el = el->nextElement();
    }
    libhtmlpp::HtmlString hs;