- Electron version: 0.37.5
- Operating system: Windows 10

When calling a window's `webContents.downloadURL(URL)` method if the specified URL returns a 404 the `will-download` event on `webContents.session` does not fire and instead a dialog pops up asking the user to save an html file (the contents of the 404 page).

Is this expected behavior and is there any event I can listen to or some other way to get around this? I'd like to handle the error differently if possible.

Thanks

atom/browser/api/atom_api_session.cc
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
    Session::CacheAction action,
    const net::CompletionCallback& callback) {
  auto request_context = context_getter->GetURLRequestContext();
  auto http_cache = request_context->http_transaction_factory()->GetCache();
  if (!http_cache)
    RunCallbackInUI<int>(callback, net::ERR_FAILED);
  
  using BackendPtr = disk_cache::Backend*;
  BackendPtr* backend_ptr = new BackendPtr(nullptr);
  net::CompletionCallback on_get_backend =
      base::Bind(&OnGetBackend, base::Owned(backend_ptr), action, callback);
  int rv = http_cache->GetBackend(backend_ptr, on_get_backend);
  if (rv != net::ERR_IO_PENDING)
    on_get_backend.Run(net::OK);
}
void SetProxyInIO(net::URLRequestContextGetter* getter,