mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 18:12:47 +03:00
Guarded JSON parse errors
This commit is contained in:
parent
05a39ac52f
commit
0e95d953e8
@ -1181,6 +1181,7 @@
|
|||||||
status:this.status,
|
status:this.status,
|
||||||
data: JSON.parse(this.responseText)
|
data: JSON.parse(this.responseText)
|
||||||
}
|
}
|
||||||
|
res.reload = res.data.reload
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
err = {
|
err = {
|
||||||
message:"Failed to parse JSON",
|
message:"Failed to parse JSON",
|
||||||
@ -1251,13 +1252,15 @@
|
|||||||
|
|
||||||
$this = this
|
$this = this
|
||||||
this.req(method,url,params,json,function(err,data) {
|
this.req(method,url,params,json,function(err,data) {
|
||||||
if (data.data.reload) {
|
if(data){
|
||||||
return document.location.reload()
|
if (data.reload) {
|
||||||
} else {
|
return document.location.reload()
|
||||||
fn = $this.gsig(data.data)
|
} else {
|
||||||
if($this.cabs[fn]) {
|
fn = $this.gsig(data.data)
|
||||||
$this.cabs[fn].call(this,err,
|
if($this.cabs[fn]) {
|
||||||
{status: data.status, data: data.data.data})
|
$this.cabs[fn].call(this,err,
|
||||||
|
{status: data.status, data: data.data.data})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user