fix bug in 'attempt' snippet

This commit is contained in:
Stefan Feješ
2018-03-23 14:28:58 +01:00
parent 53aed1383f
commit a5d3317c7d

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);
}