summaryrefslogtreecommitdiffstats
path: root/frontend/lib/catchError.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/lib/catchError.js')
-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;