| 242 | } |
| 243 | |
| 244 | static void DoCancel(const CallbackInfo& info) { |
| 245 | Function cb = info[0].As<Function>(); |
| 246 | |
| 247 | FailCancelWorker* cancelWorker = new FailCancelWorker(cb); |
| 248 | cancelWorker->Queue(); |
| 249 | cancelWorker->WaitForWorkerTaskToStart(); |
| 250 | |
| 251 | #ifdef NAPI_CPP_EXCEPTIONS |
| 252 | try { |
| 253 | cancelWorker->Cancel(); |
| 254 | } catch (Napi::Error&) { |
| 255 | Napi::Error::New(info.Env(), "Unable to cancel async worker tasks") |
| 256 | .ThrowAsJavaScriptException(); |
| 257 | } |
| 258 | #else |
| 259 | cancelWorker->Cancel(); |
| 260 | #endif |
| 261 | } |
| 262 | |
| 263 | void Execute() override { |
| 264 | NotifyJSThreadTaskHasStarted(); |
nothing calls this directly
no test coverage detected