Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit e330571

Browse files
committed
js scripts check
1 parent dd0b9d6 commit e330571

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/automations/AutomationsHelper.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import { FormulaGenerator } from "automations/FormulaGenerator";
33
import { AutomationError, showDBError } from "errors/ErrorTypes";
44

55
export async function obtainFormulasFromFolder(config: LocalSettings) {
6-
try {
7-
const generator = new FormulaGenerator(config);
8-
return await generator.generate_object();
9-
} catch (e) {
10-
showDBError(AutomationError.LoadFormulas, e);
11-
return {};
12-
}
6+
const generator = new FormulaGenerator(config);
7+
return await generator.generate_object();
138
}
149

src/automations/formula_functions/ScriptFunctions.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { IGenerateObject } from "automations/IGenerateObject";
33
import { get_tfiles_from_folder } from "helpers/FileManagement";
44
import { LocalSettings } from "cdm/SettingsModel";
55
import { LOGGER } from "services/Logger";
6+
import { AutomationError, showDBError } from "errors/ErrorTypes";
67

78
export class ScriptFunctions implements IGenerateObject {
89
constructor(private config: LocalSettings) { }
@@ -21,10 +22,17 @@ export class ScriptFunctions implements IGenerateObject {
2122

2223
for (const file of files) {
2324
if (file.extension.toLowerCase() === "js") {
24-
await this.load_script_function(
25-
file,
26-
script_functions
27-
);
25+
try {
26+
await this.load_script_function(
27+
file,
28+
script_functions
29+
);
30+
} catch (e) {
31+
showDBError({
32+
error: AutomationError.LoadFormulas.error,
33+
solution: `check your ${file.path} js file code`
34+
}, e);
35+
}
2836
}
2937
}
3038
return script_functions;

0 commit comments

Comments
 (0)