aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarak <[email protected]>2018-10-17 13:59:50 -0400
committerMarak <[email protected]>2018-10-17 18:04:44 -0400
commit09b736782621b88e779cc43903b6e2f389ae87a7 (patch)
tree6ba1bfcf28a269152ee17063a6cb03a838cdf72f /lib
parent8f76fa2ca1de4e20688d289302656f4de0c9ad11 (diff)
downloadfaker-09b736782621b88e779cc43903b6e2f389ae87a7.tar.xz
faker-09b736782621b88e779cc43903b6e2f389ae87a7.zip
[api] `faker.fake` should throw error on empty
* Was previously returning error as string * Throwing errors conforms to existing APIs
Diffstat (limited to 'lib')
-rw-r--r--lib/fake.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/fake.js b/lib/fake.js
index 7e24c854..186ca274 100644
--- a/lib/fake.js
+++ b/lib/fake.js
@@ -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 }}