diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-03-22 16:29:31 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-03-22 16:29:31 -0400 |
| commit | a6af043686e4375d7944e91cae3d5b63c59edab0 (patch) | |
| tree | f814d412b14a2a47f56c933ce38f458055f2f83b /frontend/lib/catchError.js | |
| parent | 93495ce146c4e81ecfab3a0bca99460e75a759da (diff) | |
Migrate to render props
Diffstat (limited to 'frontend/lib/catchError.js')
| -rw-r--r-- | frontend/lib/catchError.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/frontend/lib/catchError.js b/frontend/lib/catchError.js new file mode 100644 index 0000000..581d2f3 --- /dev/null +++ b/frontend/lib/catchError.js @@ -0,0 +1,8 @@ +const catchError = function(fn) { + return (...args) => + fn(...args).catch(error => { + this.setState({ error }); + }); +}; + +export default catchError; |
