MCPcopy Create free account
hub / github.com/axmolengine/axmol / onError

Method onError

core/network/Downloader-wasm.cpp:228–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226 }
227
228 void DownloaderEmscripten::onError(emscripten_fetch_t *fetch)
229 {
230 AXLOGD("DownloaderEmscripten::onLoad(fetch: {})", fmt::ptr(fetch));
231 DownloaderEmscripten* downloader = reinterpret_cast<DownloaderEmscripten*>(fetch->userData);
232 auto iter = downloader->_taskMap.find(fetch);
233 if (downloader->_taskMap.end() == iter)
234 {
235 emscripten_fetch_close(fetch);
236 AXLOGD("DownloaderEmscripten::onLoad can't find task with fetch: {}", fmt::ptr(fetch));
237 return;
238 }
239 auto context = iter->second;
240 updateTaskProgressInfo(*context->task, fetch);
241 vector<unsigned char> buf;
242 downloader->_taskMap.erase(iter);
243 downloader->onTaskFinish(*context->task,
244 DownloadTask::ERROR_IMPL_INTERNAL,
245 fetch->status,
246 fetch->statusText,
247 buf
248 );
249
250 emscripten_fetch_close(fetch);
251 context->fetch = fetch = NULL;
252 context->task.reset();
253 }
254
255 void DownloaderEmscripten::updateTaskProgressInfo(DownloadTask& task, emscripten_fetch_t *fetch)
256 {

Callers 2

em_ws_onerrorMethod · 0.45
dispatchEventsMethod · 0.45

Calls 5

ptrFunction · 0.50
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected