aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-30 01:58:46 +0800
committerGitHub <noreply@github.com>2018-05-30 01:58:46 +0800
commita4726a0e0d78416dc9fe4387d44f4a83b64c5f92 (patch)
tree97250eebad47ea12628756c075002d6fb323a429 /packages/assert
parented5b9c2b56185fc5d8e83c17d85cc8044fee0872 (diff)
parent98652997f9e460de14f7a1199eccee1951d6c4d7 (diff)
downloaddexon-sol-tools-a4726a0e0d78416dc9fe4387d44f4a83b64c5f92.tar
dexon-sol-tools-a4726a0e0d78416dc9fe4387d44f4a83b64c5f92.tar.gz
dexon-sol-tools-a4726a0e0d78416dc9fe4387d44f4a83b64c5f92.tar.bz2
dexon-sol-tools-a4726a0e0d78416dc9fe4387d44f4a83b64c5f92.tar.lz
dexon-sol-tools-a4726a0e0d78416dc9fe4387d44f4a83b64c5f92.tar.xz
dexon-sol-tools-a4726a0e0d78416dc9fe4387d44f4a83b64c5f92.tar.zst
dexon-sol-tools-a4726a0e0d78416dc9fe4387d44f4a83b64c5f92.zip
Merge pull request #621 from 0xProject/feature/compiler-assertions
Add schema assertions on public methods of @0xproject/sol-compiler
Diffstat (limited to 'packages/assert')
-rw-r--r--packages/assert/src/index.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index f3b3651d5..95c7b658b 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -64,6 +64,9 @@ export const assert = {
this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Provider', value));
},
doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
+ if (_.isUndefined(value)) {
+ throw new Error(`${variableName} can't be undefined`);
+ }
const schemaValidator = new SchemaValidator();
if (!_.isUndefined(subSchemas)) {
_.map(subSchemas, schemaValidator.addSchema.bind(schemaValidator));