From 4cbf03cb5ad0981606682a2b23dbcfcfb18e4e52 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sat, 21 Aug 2021 21:58:58 +0530 Subject: refactor: fail quickly if the initialization data is incorrect --- src/models/Service.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/models/Service.js') diff --git a/src/models/Service.js b/src/models/Service.js index c2b081864..4b78b9a40 100644 --- a/src/models/Service.js +++ b/src/models/Service.js @@ -14,7 +14,7 @@ const debug = require('debug')('Ferdi:Service'); export default class Service { id = ''; - recipe = ''; + recipe = null; _webview = null; @@ -94,13 +94,11 @@ export default class Service { constructor(data, recipe) { if (!data) { - console.error('Service config not valid'); - return null; + throw Error('Service config not valid'); } if (!recipe) { - console.error('Service recipe not valid'); - return null; + throw Error('Service recipe not valid'); } this.userAgentModel = new UserAgent(recipe.overrideUserAgent); -- cgit v1.2.3-54-g00ecf