Skip to content

Commit

Permalink
[api] faker.fake should throw error on empty
Browse files Browse the repository at this point in the history
  * Was previously returning error as string
  * Throwing errors conforms to existing APIs
  • Loading branch information
Marak committed Oct 17, 2018
1 parent 8f76fa2 commit 09b7367
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/fake.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ function Fake (faker) {

// if incoming str parameter is not provided, return error message
if (typeof str !== 'string' || str.length === 0) {
res = 'string parameter is required!';
return res;
throw new Error('string parameter is required!');
}

// find first matching {{ and }}
Expand Down

0 comments on commit 09b7367

Please sign in to comment.