How to use the @accordproject/concerto-core.Logger.error function in @accordproject/concerto-core

To help you get started, we’ve selected a few @accordproject/concerto-core 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 accordproject / cicero / packages / cicero-core / src / metadata.js View on Github external
throw new Error('Failed to find accordproject cicero version in package.json');
        }

        if(!semver.valid(semver.coerce(packageJson.accordproject.cicero))){
            throw new Error('The cicero version must be a valid semantic version (semver) number.');
        }

        if(!semver.valid(semver.coerce(packageJson.version))){
            throw new Error('The template version must be a valid semantic version (semver) number.');
        }

        this.ciceroVersion = packageJson.accordproject.cicero;

        if (!this.satisfiesCiceroVersion(ciceroVersion)){
            const msg = `The template targets Cicero version ${this.ciceroVersion} but the current Cicero version is ${ciceroVersion}.`;
            Logger.error(msg);
            throw new Error(msg);
        }

        // the runtime property is optional, and is only mandatory for templates that have been compiled
        if (packageJson.accordproject.runtime && packageJson.accordproject.runtime !== 'ergo') {
            ErgoCompiler.isValidTarget(packageJson.accordproject.runtime);
        } else {
            packageJson.accordproject.runtime = 'ergo';
        }
        this.runtime = packageJson.accordproject.runtime;

        if(!samples || typeof(samples) !== 'object') {
            throw new Error('sample.md is required');
        }

        if(request && typeof(request) !== 'object') {
github accordproject / cicero / packages / cicero-core / src / parsermanager.js View on Github external
grammarParser.feed(sourceCode);
            const grammarAst = grammarParser.results[0]; // TODO check for errors

            // Compile the AST into a set of rules
            const grammarInfoObject = compile(grammarAst, {});
            // Generate JavaScript code from the rules
            const grammarJs = generate(grammarInfoObject, 'grammar');

            // Pretend this is a CommonJS environment to catch exports from the grammar.
            const module = {
                exports: {}
            };
            eval(grammarJs);
            return module.exports;
        } catch (err) {
            Logger.error(err);
            throw err;
        }
    }
github accordproject / cicero / packages / cicero-core / src / templatelibrary.js View on Github external
.catch((err) => {
                Logger.error('Failed to load template index', err);
                throw err;
            });
    }
github accordproject / cicero / packages / cicero-cli / index.js View on Github external
}, (argv) => {
        try {
            argv = Commands.validateInvokeArgs(argv);
            const options = {
                warnings: argv.warnings,
            };
            return Commands.invoke(argv.template, argv.sample, argv.clauseName, argv.params, argv.state, argv.currentTime, options)
                .then((result) => {
                    if(result) {Logger.info(JSON.stringify(result));}
                })
                .catch((err) => {
                    Logger.error(err.message);
                });
        } catch (err){
            Logger.error(err.message);
        }
    })
    .command('initialize', 'initialize a clause', (yargs) => {
github accordproject / concerto / packages / concerto-cli / index.js View on Github external
}, (argv) => {
        if (argv.verbose) {
            Logger.info(`validate sample in ${argv.sample} against the models ${argv.ctoFiles}`);
        }

        try {
            argv = Commands.validateValidateArgs(argv);
            return Commands.validate(argv.sample, argv.ctoSystem, argv.ctoFiles)
                .then((result) => {
                    Logger.info(result);
                })
                .catch((err) => {
                    Logger.error(err.message);
                });
        } catch (err){
            Logger.error(err.message);
            return;
        }
    })
    .command('compile', 'generate code for a target platform', (yargs) => {
github accordproject / concerto / packages / concerto-cli / index.js View on Github external
.catch((err) => {
                Logger.error(err.message);
            });
    })
github accordproject / cicero / packages / cicero-cli / index.js View on Github external
.catch((err) => {
                    Logger.error(err.message + ' ' + JSON.stringify(err));
                });
        } catch (err){
github accordproject / cicero / packages / cicero-cli / index.js View on Github external
.catch((err) => {
                    Logger.error(err.message);
                });
        } catch (err){