-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from fluture-js/avaq/fork-catch
Add forkCatch - fork with exception recovery
- Loading branch information
Showing
6 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {isFuture} from '../core'; | ||
import {partial1, partial2, partial3} from '../internal/fn'; | ||
import {isFunction} from '../internal/is'; | ||
import {throwInvalidArgument, throwInvalidFuture} from '../internal/throw'; | ||
|
||
export function forkCatch(f, g, h, m){ | ||
if(!isFunction(f)) throwInvalidArgument('Future.forkCatch', 0, 'be a function', f); | ||
if(arguments.length === 1) return partial1(forkCatch, f); | ||
if(!isFunction(g)) throwInvalidArgument('Future.forkCatch', 1, 'be a function', g); | ||
if(arguments.length === 2) return partial2(forkCatch, f, g); | ||
if(!isFunction(h)) throwInvalidArgument('Future.forkCatch', 2, 'be a function', h); | ||
if(arguments.length === 3) return partial3(forkCatch, f, g, h); | ||
if(!isFuture(m)) throwInvalidFuture('Future.forkCatch', 3, m); | ||
return m._interpret(f, g, h); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters