MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / _callIsFinished

Method _callIsFinished

lib/code-caller.js:371–394  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

369 }
370
371 _callIsFinished() {
372 debug(`enter _callIsFinished(), state: ${String(this.state)}, uuid: ${this.uuid}`);
373 if (!this._checkState([IN_CALL])) return;
374 this._clearTimeout();
375 let data, err = null;
376 try {
377 data = JSON.parse(this.outputData);
378 } catch (e) {
379 err = new Error('Error decoding PythonCaller JSON: ' + e.message);
380 }
381 if (err) {
382 this.state = EXITING;
383 this.child.kill('SIGTERM');
384 this._callCallback(err);
385 } else {
386 this.state = WAITING;
387 if (data.present) {
388 this._callCallback(null, data.val, this.outputBoth);
389 } else {
390 this._callCallback(new FunctionMissingError('Function not found in module'));
391 }
392 }
393 debug(`exit _callIsFinished(), state: ${String(this.state)}, uuid: ${this.uuid}`);
394 }
395
396 _errorData() {
397 const errForStack = new Error();

Callers 1

_handleStdio3DataMethod · 0.95

Calls 4

_checkStateMethod · 0.95
_clearTimeoutMethod · 0.95
_callCallbackMethod · 0.95
debugFunction · 0.85

Tested by

no test coverage detected