How to use the node-opcua-utils.display_trace_from_this_projet_only function in node-opcua-utils

To help you get started, we’ve selected a few node-opcua-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-factory / src / factories_schema_helpers.js View on Github external
const possible_fields = obj.constructor.possibleFields;

    // extracts the fields exposed by the option object
    const current_fields = Object.keys(options);


    // get a list of field that are in the 'options' object but not in schema
    const invalid_options_fields = _.difference(current_fields, possible_fields);

    /* istanbul ignore next */
    if (invalid_options_fields.length > 0)   {
        console.log("expected schema", schema.name);
        console.log("schema", schema);
        console.log("possible_fields", possible_fields);
        console.log("invalid_options_fields= ", invalid_options_fields);
        display_trace_from_this_projet_only();
    }
    if (invalid_options_fields.length !== 0) {
        throw new Error(" invalid field found in option :" + JSON.stringify(invalid_options_fields));
    }

    // check that fields that are supposed to be array are either null or array
    for(const field of schema.fields) {
        if (field.isArray) {
            const a = options[field.name];
            if (a === undefined ||a === null ) {
                continue;
            }
            if(!(a instanceof Array)) {
                console.log("expected schema", schema.name);
                console.log("schema", schema);
                console.log("field ", field.name, " is supposed to be an array");