diff options
-rw-r--r-- | src/api/server/ServerApi.js | 17 | ||||
-rw-r--r-- | src/index.js | 1 | ||||
-rw-r--r-- | src/models/Recipe.js | 3 | ||||
-rw-r--r-- | src/models/Service.js | 7 |
4 files changed, 21 insertions, 7 deletions
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index 8b0b7563c..932b70cdc 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -499,7 +499,7 @@ export default class ServerApi { | |||
499 | 499 | ||
500 | return recipe; | 500 | return recipe; |
501 | }), | 501 | }), |
502 | ).catch(err => console.error(err)); | 502 | ).catch(err => console.error('Can\'t load recipe', err)); |
503 | } | 503 | } |
504 | 504 | ||
505 | _mapRecipePreviewModel(recipes) { | 505 | _mapRecipePreviewModel(recipes) { |
@@ -562,9 +562,16 @@ export default class ServerApi { | |||
562 | .filter(file => fs.statSync(path.join(recipesDirectory, file)).isDirectory() && file !== 'temp'); | 562 | .filter(file => fs.statSync(path.join(recipesDirectory, file)).isDirectory() && file !== 'temp'); |
563 | 563 | ||
564 | const recipes = paths.map((id) => { | 564 | const recipes = paths.map((id) => { |
565 | // eslint-disable-next-line | 565 | let Recipe; |
566 | const Recipe = require(id)(RecipeModel); | 566 | try { |
567 | return new Recipe(loadRecipeConfig(id)); | 567 | // eslint-disable-next-line |
568 | Recipe = require(id)(RecipeModel); | ||
569 | return new Recipe(loadRecipeConfig(id)); | ||
570 | } catch (err) { | ||
571 | console.error(err); | ||
572 | } | ||
573 | |||
574 | return false; | ||
568 | }).filter(recipe => recipe.id).map((data) => { | 575 | }).filter(recipe => recipe.id).map((data) => { |
569 | const recipe = data; | 576 | const recipe = data; |
570 | 577 | ||
@@ -579,7 +586,7 @@ export default class ServerApi { | |||
579 | 586 | ||
580 | return recipes; | 587 | return recipes; |
581 | } catch (err) { | 588 | } catch (err) { |
582 | console.debug('Folder `recipe/dev` does not exist'); | 589 | console.debug('Could not load dev recipes'); |
583 | return false; | 590 | return false; |
584 | } | 591 | } |
585 | } | 592 | } |
diff --git a/src/index.js b/src/index.js index a72d76f3a..a3aa14732 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -18,6 +18,7 @@ let willQuitApp = false; | |||
18 | 18 | ||
19 | // Ensure that the recipe directory exists | 19 | // Ensure that the recipe directory exists |
20 | fs.ensureDir(path.join(app.getPath('userData'), 'recipes')); | 20 | fs.ensureDir(path.join(app.getPath('userData'), 'recipes')); |
21 | fs.emptyDirSync(path.join(app.getPath('userData'), 'recipes', 'temp')); | ||
21 | 22 | ||
22 | // Set App ID for Windows | 23 | // Set App ID for Windows |
23 | if (isWindows) { | 24 | if (isWindows) { |
diff --git a/src/models/Recipe.js b/src/models/Recipe.js index 4b613a40c..9971df77c 100644 --- a/src/models/Recipe.js +++ b/src/models/Recipe.js | |||
@@ -26,7 +26,8 @@ export default class Recipe { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | if (!data.id) { | 28 | if (!data.id) { |
29 | throw Error('Recipe requires Id'); | 29 | // Franz 4 recipes do not have an Id |
30 | throw Error(`Recipe '${data.name}' requires Id`); | ||
30 | } | 31 | } |
31 | 32 | ||
32 | this.id = data.id || this.id; | 33 | this.id = data.id || this.id; |
diff --git a/src/models/Service.js b/src/models/Service.js index 7a0310ebc..484252e7c 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -58,7 +58,12 @@ export default class Service { | |||
58 | 58 | ||
59 | @computed get url() { | 59 | @computed get url() { |
60 | if (this.recipe.hasCustomUrl && this.customUrl) { | 60 | if (this.recipe.hasCustomUrl && this.customUrl) { |
61 | let url = normalizeUrl(this.customUrl); | 61 | let url; |
62 | try { | ||
63 | url = normalizeUrl(this.customUrl); | ||
64 | } catch (err) { | ||
65 | console.error(`Service (${this.recipe.name}): '${this.customUrl}' is not a valid Url.`); | ||
66 | } | ||
62 | 67 | ||
63 | if (typeof this.recipe.buildUrl === 'function') { | 68 | if (typeof this.recipe.buildUrl === 'function') { |
64 | url = this.recipe.buildUrl(url); | 69 | url = this.recipe.buildUrl(url); |