Better request error handling
This commit is contained in:
parent
5e9e1ca90d
commit
69e7927a96
|
@ -633,6 +633,14 @@
|
|||
{
|
||||
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),
|
||||
progress: function progress(e)
|
||||
{
|
||||
starter.emulator_bus.send("download-progress", {
|
||||
file_index: index,
|
||||
file_count: total,
|
||||
file_name: f.url,
|
||||
if(e.target.status === 200)
|
||||
{
|
||||
starter.emulator_bus.send("download-progress", {
|
||||
file_index: index,
|
||||
file_count: total,
|
||||
file_name: f.url,
|
||||
|
||||
lengthComputable: e.lengthComputable,
|
||||
total: e.total || f.size,
|
||||
loaded: e.loaded,
|
||||
});
|
||||
lengthComputable: e.lengthComputable,
|
||||
total: e.total || f.size,
|
||||
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,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue