Skip to content

Commit

Permalink
refactor: use better errors message
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-fadaei committed Nov 7, 2021
1 parent 6662910 commit 778040e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/runners/parallel-tasks-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ParallelTasksRunner<T> extends BaseTasksRunner<T> {

public get(index: number): Promise<T> {
if (this.status === "open") {
return Promise.reject(new Error("Task runner is open"));
return Promise.reject(new Error("Task runner not yet started"));
}

// show error if the index is out of bounds
Expand Down
4 changes: 2 additions & 2 deletions src/runners/pipeline-tasks-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class PipelineTasksRunner<T> extends BaseTasksRunner<T> {

public async get(index: number): Promise<T> {
if (this.status === "open") {
return Promise.reject(new Error("Task runner is open"));
return Promise.reject(new Error("Task runner is not yet started"));
}

// show error if the index is out of bounds
Expand All @@ -98,7 +98,7 @@ export class PipelineTasksRunner<T> extends BaseTasksRunner<T> {
const nextTask = taskIterator.next(lastResult);
lastResult = await nextTask.value;
} catch {
return Promise.reject(new Error("Task not reached"));
return Promise.reject(new Error("Task failed before reach"));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/runners/serial-tasks-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class SerialTasksRunner<T> extends BaseTasksRunner<T> {

public async get(index: number): Promise<T> {
if (this.status === "open") {
return Promise.reject(new Error("Task runner is open"));
return Promise.reject(new Error("Task runner is not yet started"));
}

// show error if the index is out of bounds
Expand All @@ -80,7 +80,7 @@ export class SerialTasksRunner<T> extends BaseTasksRunner<T> {
const nextTask = taskIterator.next()
await nextTask.value;
} catch {
return Promise.reject(new Error("Task not reached"));
return Promise.reject(new Error("Task failed before reach"));
}
}

Expand Down

0 comments on commit 778040e

Please sign in to comment.