- 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
new ResolveProxyHelper(browser_context(), url, callback);
}
template<Session::CacheAction action>
void Session::DoCacheAction(const net::CompletionCallback& callback) {
  BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
      base::Bind(&DoCacheActionInIO,
                 make_scoped_refptr(browser_context_->GetRequestContext()),
                 action,
                 callback));
}
void Session::ClearStorageData(mate::Arguments* args) {
  
  ClearStorageDataOptions options;
  args->GetNext(&options);
  base::Closure callback;
  if (!args->GetNext(&callback)) {
    args->ThrowError();
    return;
  }
  auto storage_partition =
      content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
  storage_partition->ClearData(
      options.storage_types, options.quota_types, options.origin,
      content::StoragePartition::OriginMatcherFunction(),
      base::Time(), base::Time::Max(), callback);
}
void Session::FlushStorageData() {