Skip to content

Sync error of handler should throw a global error #455

@satazor

Description

@satazor
// foo.js
'use strict';

const yargs = require('yargs');

yargs
.help('help').alias('help', 'h')
.command('foo', 'Foo command is awesome', () => {
    console.log('foo handler');
    throw new Error('This error will show below the help');
})
.argv;

If you now run node foo it will show the usage and the error below.

screen shot 2016-03-26 at 21 39 45

I was expecting the error to be thrown globally and not being handled by yargs.

yargs version: 4.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions