ssssssss-team/spider-flow · error · Error

This is abstract class

Error message

This is abstract class

What it means

jsontree.js implements _NodeSimple as an abstract base class: simple leaf node types (string, number, boolean, null) must subclass it. The constructor explicitly throws when instantiated directly (this.constructor === _NodeSimple) so that developers cannot create incomplete leaf nodes that lack the subclass's rendering behavior.

Solutions

  1. Instantiate the concrete node class matching the value type (e.g. the string/number/boolean/null subclasses) instead of _NodeSimple.
  2. If a custom node type is needed, create a subclass that calls _NodeSimple.apply(this, arguments) (or .call) and only then use `new SubClass(...)`.
  3. Search your code for `new _NodeSimple` and route it through the library's factory/registry that maps value types to node classes.

Example fix

// before
var node = new _NodeSimple('key', value, isLast);
// after
var NodeClass = getValueNodeClass(value); // concrete subclass per type
var node = new NodeClass('key', value, isLast);
Defensive patterns

Strategy: type-guard

Validate before calling

function canCreateSimpleNode(Ctor) { return typeof Ctor === 'function' && Ctor !== _NodeSimple && Ctor.prototype instanceof _NodeSimple; }

Type guard

function isConcreteNodeClass(Ctor) { return typeof Ctor === 'function' && Ctor !== _NodeSimple && (Ctor.prototype instanceof _NodeSimple); }

Try / catch

try {
  node = new NodeClass(label, val, isLast);
} catch (e) {
  if (e.message === 'This is abstract class') { node = getConcreteNodeClass(value); node = new node(label, val, isLast); }
  else throw e;
}

Prevention

When it happens

Trigger: Calling `new _NodeSimple(label, val, isLast)` directly instead of instantiating a concrete subclass such as the string/number/boolean/null node classes defined later in jsontree.js.

Common situations: Developers customizing the JSON tree widget call the base class directly, or copy example code that used a concrete subclass and mistakenly substitute the abstract one, or plugin code maps JSON value types to node classes and falls back to the base class for simple values.

Understand the failure class

Background: "NotImplementedError: Subclasses should override this method" / "must be implemented" — abstract method errors explained — this error's family across 40 libraries.

Related errors


AI-assisted analysis of ssssssss-team/spider-flow@c799cca99c (2026-09-08). Data as JSON: /api/errors/cd9e09ef3e53a3ad. Report an issue: GitHub.

Appendix: source

Thrown at spider-flow-web/src/main/resources/static/js/jsontree/jsontree.js:217

     *
     * Markup:
     * <li class="jsontree_node">
     *     <span class="jsontree_label-wrapper">
     *         <span class="jsontree_label">"age"</span>
     *         :
     *     </span>
     *     <span class="jsontree_value jsontree_value_(number|boolean|string|null)">25</span>
     *     ,
     * </li>
     *
     * @abstract
     * @param label {string} - key name
     * @param val {string | number | boolean | null} - a value of simple types
     * @param isLast {boolean} - true if node is last in list of parent childNodes
     */
    function _NodeSimple(label, val, isLast) {
        if (this.constructor === _NodeSimple) {
            throw new Error('This is abstract class');
        }
        
        var self = this,
            el = document.createElement('li'),
            labelEl,
            template = function(label, val) {
                var str = '\
                    <span class="jsontree_label-wrapper">\
                        <span class="jsontree_label">"' +
                            label +
                        '"</span> : \
                    </span>\
                    <span class="jsontree_value-wrapper">\
                        <span class="jsontree_value jsontree_value_' + self.type + '">' +
                            val +
                        '</span>' +
                        (!isLast ? ',' : '') + 
                    '</span>';

View on GitHub (pinned to c799cca99c)