How to use the verror.fullStack function in verror

To help you get started, we’ve selected a few verror 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 cucumber / cucumber-js / src / cli / run.js View on Github external
function exitWithError(error) {
  console.error(VError.fullStack(error)) // eslint-disable-line no-console
  process.exit(1)
}
github cucumber / cucumber-js / src / runtime / parallel / slave.js View on Github external
await Promise.each(this.supportCodeLibrary[key], async hookDefinition => {
      const { error } = await UserCodeRunner.run({
        argsArray: [],
        fn: hookDefinition.code,
        thisArg: null,
        timeoutInMilliseconds:
          hookDefinition.options.timeout ||
          this.supportCodeLibrary.defaultTimeout,
      })
      if (error) {
        const location = formatLocation(hookDefinition)
        console.error(
          VError.fullStack(
            new VError(
              error,
              `${name} hook errored on slave ${this.id}, process exiting: ${location}`
            )
          )
        ) // eslint-disable-line no-console
        this.exit(1)
      }
    })
  }
github pmarkert / hyperpotamus / hyperpotamus.js View on Github external
function dumpError(message, err) {
	var cause = findCause(err);
	var dump = {
		name: cause.name,
		message: cause.message
	};
	var path = findDeepestInfoProperty(err, "path");
	if(!_.isNil(path)) {
		dump.path = path;
	}
	dump.help_link = `https://github.com/pmarkert/hyperpotamus/wiki/errors#${cause.name}`;
	logger.debug(`Error stack-trace:\n${verror.fullStack(err)}`);
	logger.info(`Error details:\n${yaml.dump(verror.info(err), { lineWidth: process.stdout.columns, skipInvalid: true })}`);
	logger.error(`Error occurred while ${message}:\n${yaml.dump(dump, { lineWidth: process.stdout.columns, skipInvalid: true })}`);
	process.exit(1);
}
github particle-iot / particle-cli / src / cmd / doctor.js View on Github external
_showDoctorError(e){
		if (e instanceof EarlyReturnError){
			return;
		}

		const msg = (e && e.message) || '';
		console.log(`The Doctor didn't complete successfully. ${msg}`);

		if (global.verboseLevel > 1){
			console.log(VError.fullStack(e));
		}
		console.log(chalk.cyan('>'), 'Please visit our community forums for help with this error:');
		console.log(chalk.bold.white('https://community.particle.io/'));
	}
};
github cucumber / cucumber-js / features / support / world.js View on Github external
const cli = new Cli({
        argv: args,
        cwd,
        stdout,
      })
      let error, stderr
      try {
        const { success } = await cli.run()
        if (!success) {
          error = new Error('CLI exited with non-zero')
          error.code = 42
        }
        stderr = ''
      } catch (err) {
        error = err
        stderr = VError.fullStack(error)
      }
      stdout.end()
      result = { error, stdout: await toString(stdout), stderr }
    }
    const envelopes = []
    const messageOutputPath = path.join(cwd, messageFilename)
    if (fs.existsSync(messageOutputPath)) {
      const data = fs.readFileSync(messageOutputPath)
      const reader = protobuf.Reader.create(data)
      while (reader.pos < reader.len) {
        envelopes.push(messages.Envelope.decodeDelimited(reader))
      }
      fs.writeFileSync(
        path.join(cwd, 'message.out.json'),
        JSON.stringify(envelopes.map(e => e.toJSON()), null, 2)
      )