From 0e95d953e837cc88698a0764a77e66b3f529f11d Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Fri, 10 Oct 2014 15:17:28 -0700 Subject: [PATCH] Guarded JSON parse errors --- arvo/eyre.hoon | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon index 81cfc8ce4a..c68f1137ba 100644 --- a/arvo/eyre.hoon +++ b/arvo/eyre.hoon @@ -1181,6 +1181,7 @@ status:this.status, data: JSON.parse(this.responseText) } + res.reload = res.data.reload } catch(e) { err = { message:"Failed to parse JSON", @@ -1251,13 +1252,15 @@ $this = this this.req(method,url,params,json,function(err,data) { - if (data.data.reload) { - return document.location.reload() - } else { - fn = $this.gsig(data.data) - if($this.cabs[fn]) { - $this.cabs[fn].call(this,err, - {status: data.status, data: data.data.data}) + if(data){ + if (data.reload) { + return document.location.reload() + } else { + fn = $this.gsig(data.data) + if($this.cabs[fn]) { + $this.cabs[fn].call(this,err, + {status: data.status, data: data.data.data}) + } } }