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
refactor: applied changes for pull request
[e-mobility-charging-stations-simulator.git]
/
src
/
worker
/
WorkerAbstract.ts
diff --git
a/src/worker/WorkerAbstract.ts
b/src/worker/WorkerAbstract.ts
index 3dd9a782a8661507f61fa21787ed9f80c9465852..16d566bde2ae60049fe401c7f13f830af4ce17dd 100644
(file)
--- a/
src/worker/WorkerAbstract.ts
+++ b/
src/worker/WorkerAbstract.ts
@@
-27,9
+27,12
@@
export abstract class WorkerAbstract<T extends WorkerData> {
messageHandler: WorkerConstants.EMPTY_FUNCTION,
}
) {
messageHandler: WorkerConstants.EMPTY_FUNCTION,
}
) {
- if (
!workerScript
) {
+ if (
workerScript === null || workerScript === undefined
) {
throw new Error('Worker script is not defined');
}
throw new Error('Worker script is not defined');
}
+ if (typeof workerScript === 'string' && workerScript.trim().length === 0) {
+ throw new Error('Worker script is empty');
+ }
if (!fs.existsSync(workerScript)) {
throw new Error('Worker script file does not exist');
}
if (!fs.existsSync(workerScript)) {
throw new Error('Worker script file does not exist');
}