mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Improve stacktraces from pyCall
Summary: Capture the stacktrace (via SandboxError) in `_pyCallWait` instead of `_onSandboxMsg` where it's always the same. Test Plan: Tested manually, found for example that the stacktrace in the logs changed from being rather useless: ``` at NSandbox._onSandboxMsg (/home/alex/work/grist/_build/core/app/server/lib/NSandbox.js:229:36) at /home/alex/work/grist/_build/core/app/server/lib/NSandbox.js:179:18 at Unmarshaller.parse (/home/alex/work/grist/_build/core/app/common/marshal.js:289:21) at NSandbox._onSandboxData (/home/alex/work/grist/_build/core/app/server/lib/NSandbox.js:174:28) at Socket.<anonymous> (/home/alex/work/grist/_build/core/app/server/lib/NSandbox.js:63:59) at Socket.emit (events.js:315:20) at Socket.EventEmitter.emit (domain.js:467:12) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) ``` to being somewhat more helpful: ``` at NSandbox._pyCallWait (/home/alex/work/grist/_build/core/app/server/lib/NSandbox.js:134:19) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async ActiveDoc.applyActionsToDataEngine (/home/alex/work/grist/_build/core/app/server/lib/ActiveDoc.js:1080:39) at async Sharing._applyActionsToDataEngine (/home/alex/work/grist/_build/core/app/server/lib/Sharing.js:325:37) ``` Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D3329
This commit is contained in:
parent
2c9ae6dc94
commit
1452b6efc3
@ -213,6 +213,8 @@ export class NSandbox implements ISandbox {
|
||||
return await new Promise((resolve, reject) => {
|
||||
this._pendingReads.push([resolve, reject]);
|
||||
});
|
||||
} catch (e) {
|
||||
throw new sandboxUtil.SandboxError(e.message);
|
||||
} finally {
|
||||
if (this._logTimes) {
|
||||
log.rawDebug(`Sandbox pyCall[${funcName}] took ${Date.now() - startTime} ms`, this._logMeta);
|
||||
@ -318,7 +320,7 @@ export class NSandbox implements ISandbox {
|
||||
const resolvePair = this._pendingReads.shift();
|
||||
if (resolvePair) {
|
||||
if (msgCode === sandboxUtil.EXC) {
|
||||
resolvePair[1](new sandboxUtil.SandboxError(data));
|
||||
resolvePair[1](new Error(data));
|
||||
} else if (msgCode === sandboxUtil.DATA) {
|
||||
resolvePair[0](data);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user