repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Insomnia UI protocol collection
[e-mobility-charging-stations-simulator.git]
/
src
/
worker
/
WorkerAbstract.ts
diff --git
a/src/worker/WorkerAbstract.ts
b/src/worker/WorkerAbstract.ts
index bfb7933639eb1e3445e6bd71cafeef12807f2b3e..27f947d1a0f04ec987b798c61948e1bed8572061 100644
(file)
--- a/
src/worker/WorkerAbstract.ts
+++ b/
src/worker/WorkerAbstract.ts
@@
-1,5
+1,6
@@
-import
{ WorkerData, WorkerOptions } from '../types/Worker
';
+import
fs from 'fs
';
+import type { WorkerData, WorkerOptions } from '../types/Worker';
import WorkerConstants from './WorkerConstants';
export default abstract class WorkerAbstract<T extends WorkerData> {
import WorkerConstants from './WorkerConstants';
export default abstract class WorkerAbstract<T extends WorkerData> {
@@
-28,6
+29,12
@@
export default abstract class WorkerAbstract<T extends WorkerData> {
},
}
) {
},
}
) {
+ if (!workerScript) {
+ throw new Error('Worker script is not defined');
+ }
+ if (!fs.existsSync(workerScript)) {
+ throw new Error('Worker script file does not exist');
+ }
this.workerScript = workerScript;
this.workerOptions = workerOptions;
}
this.workerScript = workerScript;
this.workerOptions = workerOptions;
}