- 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/save_page_handler.cc
if (item->IsDone()) {
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    v8::Locker locker(isolate);
    v8::HandleScope handle_scope(isolate);
    if (item->GetState() == content::DownloadItem::COMPLETE) {
      callback_.Run(v8::Null(isolate));
    } else {
      v8::Local<v8::String> error_message = v8::String::NewFromUtf8(
          isolate, "Fail to save page");
      callback_.Run(v8::Exception::Error(error_message));
    }
    Destroy(item);
  }
}
void SavePageHandler::Destroy(content::DownloadItem* item) {
  item->RemoveObserver(this);
  delete this;
}
bool SavePageHandler::IsSavePageTypes(const std::string& type) {
  return type == "multipart/related" || type == "text/html";
}
}  
}