MCPcopy Create free account
hub / github.com/FastLED/FastLED / js_fetch_error_callback

Function js_fetch_error_callback

src/platforms/wasm/js_fetch.cpp.hpp:116–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115// C++ error callback function that JavaScript can call when fetch fails
116extern "C" EMSCRIPTEN_KEEPALIVE void js_fetch_error_callback(u32 request_id, const char* error_message) {
117 FL_WARN("Fetch error callback received for request " << request_id << ": " << error_message);
118
119 auto callback_opt = getCallbackManager().takeCallback(request_id);
120 if (callback_opt) {
121 // Create an error response object using unified fl::response
122 fl::net::http::Response response(0, "Network Error");
123 fl::string error_content = "Fetch Error: ";
124 error_content += error_message;
125 response.set_body(error_content);
126
127 (*callback_opt)(response);
128 } else {
129 FL_WARN("Warning: No pending callback found for fetch error request " << request_id);
130 }
131 // See note in js_fetch_success_callback above.
132 fl::platforms::ICoroutineRuntime::instance().wakeWaiters();
133}
134
135void WasmFetchRequest::response(const FetchResponseCallback& callback) {
136 FL_WARN("Starting JavaScript-based fetch request to: " << mUrl);

Callers

nothing calls this directly

Calls 3

takeCallbackMethod · 0.80
set_bodyMethod · 0.80
wakeWaitersMethod · 0.80

Tested by

no test coverage detected