Better request error handling
This commit is contained in:
parent
5e9e1ca90d
commit
69e7927a96
|
@ -633,6 +633,14 @@
|
||||||
{
|
{
|
||||||
show_progress(e);
|
show_progress(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
emulator.add_listener("download-error", function(e)
|
||||||
|
{
|
||||||
|
var el = $("loading");
|
||||||
|
el.style.display = "block";
|
||||||
|
el.textContent = "Loading " + e.file_name + " failed. Check your connection " +
|
||||||
|
"and reload the page to try again.";
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -355,15 +355,27 @@ function V86Starter(options)
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
progress: function progress(e)
|
progress: function progress(e)
|
||||||
{
|
{
|
||||||
starter.emulator_bus.send("download-progress", {
|
if(e.target.status === 200)
|
||||||
file_index: index,
|
{
|
||||||
file_count: total,
|
starter.emulator_bus.send("download-progress", {
|
||||||
file_name: f.url,
|
file_index: index,
|
||||||
|
file_count: total,
|
||||||
|
file_name: f.url,
|
||||||
|
|
||||||
lengthComputable: e.lengthComputable,
|
lengthComputable: e.lengthComputable,
|
||||||
total: e.total || f.size,
|
total: e.total || f.size,
|
||||||
loaded: e.loaded,
|
loaded: e.loaded,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
starter.emulator_bus.send("download-error", {
|
||||||
|
file_index: index,
|
||||||
|
file_count: total,
|
||||||
|
file_name: f.url,
|
||||||
|
request: e.target,
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
as_text: f.as_text,
|
as_text: f.as_text,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue