Skip to content

string.numeric does not mention the possibility to throw in it's docs #4018

Description

@xDivisionByZerox

Description

Our coding guidelines for JSDocs state that a faker function that is able throw should that that in their JSDocs.

> If a function can throw an error (FakerError) you have to include the `@throws` tag with an explanation when an error could be thrown

While reviewing #3857 I noticed that faker.string.numeric does not have any throw comments, while clearly having possible errors being thrown during runtime:

throw new FakerError(
'Unable to generate numeric string, because all possible digits are excluded.'
);

Task

Add JSDocs stating that the function can throw as described in our guidelines.

In this specific case I would expect two separate throw statements as a comment:

  • No digits at all are allowed by allowedDigits
  • Leading zeros are disallowed by the only allowed digit is 0

Metadata

Metadata

Labels

c: docsImprovements or additions to documentationgood first issueGood for newcomersp: 1-normalNothing urgent

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions