(request: CompilationRequest)
| 433 | } |
| 434 | |
| 435 | sendCMakeCompile(request: CompilationRequest): void { |
| 436 | const onCompilerResponse = this.onCMakeResponse.bind(this); |
| 437 | |
| 438 | if (this.pendingCMakeRequestSentAt) { |
| 439 | // If we have a request pending, then just store this request to do once the |
| 440 | // previous request completes. |
| 441 | this.nextCMakeRequest = request; |
| 442 | return; |
| 443 | } |
| 444 | // this.eventHub.emit('compiling', this.id, this.compiler); |
| 445 | // Display the spinner |
| 446 | this.handleCompilationStatus({code: 4}); |
| 447 | this.pendingCMakeRequestSentAt = Date.now(); |
| 448 | // After a short delay, give the user some indication that we're working on their |
| 449 | // compilation. |
| 450 | this.hub.compilerService |
| 451 | .submitCMake(request) |
| 452 | .then((x: any) => { |
| 453 | onCompilerResponse(request, x.result, x.localCacheHit); |
| 454 | }) |
| 455 | .catch(x => { |
| 456 | let message = 'Unknown error'; |
| 457 | const isNetworkError = (x as any)?.isNetworkError === true; |
| 458 | if (_.isString(x)) { |
| 459 | message = x; |
| 460 | } else if (x) { |
| 461 | message = x.error || x.code || x.message || x; |
| 462 | } |
| 463 | const result = isNetworkError |
| 464 | ? {...this.errorResult(message), networkError: true} |
| 465 | : this.errorResult(message); |
| 466 | onCompilerResponse(request, result, false); |
| 467 | }); |
| 468 | } |
| 469 | |
| 470 | sendCompile(request: CompilationRequest): void { |
| 471 | const onCompilerResponse = this.onCompileResponse.bind(this); |
no test coverage detected