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
Description
Our coding guidelines for JSDocs state that a faker function that is able throw should that that in their JSDocs.
faker/CONTRIBUTING.md
Line 362 in bbd1693
While reviewing #3857 I noticed that
faker.string.numericdoes not have anythrowcomments, while clearly having possible errors being thrown during runtime:faker/src/modules/string/module.ts
Lines 559 to 561 in bbd1693
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:
allowedDigits0