Merge pull request #639 from Chalarangelo/bugFix

[FIX: #638] bug in 'attempt' snippet
This commit is contained in:
Angelos Chalaris
2018-03-23 15:41:41 +02:00
committed by GitHub

View File

@ -7,7 +7,7 @@ Use a `try... catch` block to return either the result of the function or an app
```js
const attempt = (fn, ...args) => {
try {
return fn(args);
return fn(...args);
} catch (e) {
return e instanceof Error ? e : new Error(e);
}