From a6af043686e4375d7944e91cae3d5b63c59edab0 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 22 Mar 2018 16:29:31 -0400 Subject: Migrate to render props --- frontend/lib/catchError.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 frontend/lib/catchError.js (limited to 'frontend/lib') 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; -- cgit v1.3