aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Recipe.ts
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-21 21:58:58 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-08-21 21:58:58 +0530
commit4cbf03cb5ad0981606682a2b23dbcfcfb18e4e52 (patch)
tree14f1b501eb5e0de88365c02fd375dc816a37c4a2 /src/models/Recipe.ts
parentstyle: consistent syntax style [skip ci] (diff)
downloadferdium-app-4cbf03cb5ad0981606682a2b23dbcfcfb18e4e52.tar.gz
ferdium-app-4cbf03cb5ad0981606682a2b23dbcfcfb18e4e52.tar.zst
ferdium-app-4cbf03cb5ad0981606682a2b23dbcfcfb18e4e52.zip
refactor: fail quickly if the initialization data is incorrect
Diffstat (limited to 'src/models/Recipe.ts')
-rw-r--r--src/models/Recipe.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/models/Recipe.ts b/src/models/Recipe.ts
index 33d383983..0a93fbc5a 100644
--- a/src/models/Recipe.ts
+++ b/src/models/Recipe.ts
@@ -76,12 +76,8 @@ export default class Recipe {
76 throw Error(`Recipe '${data.name}' requires Id`); 76 throw Error(`Recipe '${data.name}' requires Id`);
77 } 77 }
78 78
79 try { 79 if (!semver.valid(data.version)) {
80 if (!semver.valid(data.version)) { 80 throw Error(`Version ${data.version} of recipe '${data.name}' is not a valid semver version`);
81 throw Error(`Version ${data.version} of recipe '${data.name}' is not a valid semver version`);
82 }
83 } catch (e) {
84 console.warn(e.message);
85 } 81 }
86 82
87 this.id = data.id || this.id; 83 this.id = data.id || this.id;