try-catch
v0.9.6arrow_drop_downv0.9.6
STATUS
Passing
DOWNLOADS
1
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
N/A
`tryCatch` takes two functions, a `tryer` and a `catcher`.
1 contributor
Like
Install try-catch as a package?
Copied
npm i @bit/justin-capalbo.ramda.try-catch
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
chevron_left
chevron_right
tryCatch (
tryer:
Function
,catcher:
) : Function
Function
tryCatch
takes two functions, a tryer
and a catcher
. The returned
function evaluates the tryer
; if it does not throw, it simply returns the
result. If the tryer
does throw, the returned function evaluates the
catcher
function and returns its result. Note that for effective
composition with this function, both the tryer
and catcher
functions
must return the same type of results.
Example
Arguments
tryer:
Function
The function that may throw.
catcher:
Function
The function that will be evaluated if tryer
throws.
Returns
Function
A new function that will catch exceptions and send then to the catcher.