commit db40538038a4a3b203ee3276221ae3f68ea63aa3 parent cc450448e1df94599df6f625d3026772a83a0f18 Author: Johan Lindskogen <johan.lindskogen@gmail.com> Date: Sun, 1 Apr 2018 16:25:41 +0200 Handle errors in transformed actions Diffstat:
M | src/lib/weechat/connection.ts | | | 11 | +++++++---- |
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/lib/weechat/connection.ts b/src/lib/weechat/connection.ts @@ -30,10 +30,13 @@ export default class WeechatConnection { const parsed = protocol.parse(event.data) as WeechatResponse<any>; console.log("Parsed data:", parsed); - const action = transformToReduxAction(parsed); - - if (action) { - this.dispatch(action); + try { + const action = transformToReduxAction(parsed); + if (action) { + this.dispatch(action); + } + } catch (e) { + console.log(e, parsed); } }