Skip to content

If two arguments are passed but on the 2nd is verified the resulting error is misleading #1

Description

@leggetter

Say I've the following:

var using = require( 'typester' ).using;

function Thing( name, number ) {
  using( arguments )
    .verify( 'number' ).fulfills( Number );
}

Should this always fail because I'm not also checking the name argument which is part of arguments?

In this scenario I'm seeing an error stating that the number isn't fulfilling Number. When I think it should actually be saying something like All arguments weren't checked.

If I instead do:

var using = require( 'typester' ).using;

function Thing( name, number ) {
  using( arguments )
    .verify( 'name' ).fulfills( String );
}

I get the following error:

ArgumentError: only 1 argument(s) verified but 2 were provided

Which is much more informative. Maybe just some sorting check problem?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions