Skip to content

Commit

Permalink
fix(task): Changed fromPromise logic to reject with value as is
Browse files Browse the repository at this point in the history
  • Loading branch information
hrajchert committed Dec 9, 2017
1 parent 98359e9 commit 3912fb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export class Task <T, E> {
});
}

static fromPromise<TResult> (promise: Promise<TResult>): Task<TResult, UncaughtError> {
static fromPromise<TResult> (promise: Promise<TResult>): Task<TResult, any> {
return new Task((outerResolve, outerReject) => {
promise.then(outerResolve, err => outerReject(new UncaughtError(err)));
promise.then(outerResolve, err => outerReject(err));
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('Task', () => {

// WHEN: we fork, THEN: it should call the error function with the rejected value
resolved.fork(
assertFork(cb, x => expect(x).toBeInstanceOf(UncaughtError)),
assertFork(cb, x => expect(x).toBe('buu')),
jestAssertNever(cb)
);
});
Expand Down

0 comments on commit 3912fb1

Please sign in to comment.