summaryrefslogtreecommitdiffstats
path: root/frontend/lib
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-03-22 16:29:31 -0400
committerWes Bos <wesbos@gmail.com>2018-03-22 16:29:31 -0400
commita6af043686e4375d7944e91cae3d5b63c59edab0 (patch)
treef814d412b14a2a47f56c933ce38f458055f2f83b /frontend/lib
parent93495ce146c4e81ecfab3a0bca99460e75a759da (diff)
Migrate to render props
Diffstat (limited to 'frontend/lib')
-rw-r--r--frontend/lib/catchError.js8
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;