Overhauled AJAX error reporting

This adds event sources & listeners for load failures. Currently these are triggered by AJAX requests either failing immediately or when the HTTP response is something other than 200, which in both cases will display a message in the viewport stating that the image could not be loaded.

We should review how we want to make this customizable: I think we'd want to add the ability for users to pass in something like an error handler / dialog display function as part of the viewer config so they can completely control every detail.

n.b. this branch was based on the branch for #149 so the first 4 commits will “disappear” when that's merged.