Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 6, 2018. It is now read-only.

Commit 1f34d21

Browse filesBrowse files
committed
fix: propagate stack traces
1 parent a073382 commit 1f34d21
Copy full SHA for 1f34d21

2 files changed

+14-2Lines changed: 14 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/protocol/jsonrpc2/connection.test.ts‎

Copy file name to clipboardExpand all lines: src/protocol/jsonrpc2/connection.test.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ describe('Connection', () => {
7676
(error: ResponseError<any>) => {
7777
assert.strictEqual(error.code, ErrorCodes.InternalError)
7878
assert.strictEqual(error.message, 'test')
79+
assert.strictEqual(error.data && typeof error.data.stack, 'string')
7980
}
8081
)
8182
})
@@ -95,6 +96,7 @@ describe('Connection', () => {
9596
(error: ResponseError<any>) => {
9697
assert.strictEqual(error.code, ErrorCodes.InternalError)
9798
assert.strictEqual(error.message, 'test')
99+
assert.strictEqual(error.data && typeof error.data.stack, 'string')
98100
}
99101
)
100102
})
Collapse file

‎src/protocol/jsonrpc2/connection.ts‎

Copy file name to clipboardExpand all lines: src/protocol/jsonrpc2/connection.ts
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,12 @@ function _createConnection(transports: MessageTransports, logger: Logger, strate
365365
if (error instanceof ResponseError) {
366366
replyError(error as ResponseError<any>)
367367
} else if (error && typeof error.message === 'string') {
368-
replyError(new ResponseError<void>(ErrorCodes.InternalError, error.message))
368+
replyError(
369+
new ResponseError<void>(ErrorCodes.InternalError, error.message, {
370+
stack: error.stack,
371+
...error,
372+
})
373+
)
369374
} else {
370375
replyError(
371376
new ResponseError<void>(
@@ -387,7 +392,12 @@ function _createConnection(transports: MessageTransports, logger: Logger, strate
387392
if (error instanceof ResponseError) {
388393
reply(error as ResponseError<any>)
389394
} else if (error && typeof error.message === 'string') {
390-
replyError(new ResponseError<void>(ErrorCodes.InternalError, error.message))
395+
replyError(
396+
new ResponseError<void>(ErrorCodes.InternalError, error.message, {
397+
stack: error.stack,
398+
...error,
399+
})
400+
)
391401
} else {
392402
replyError(
393403
new ResponseError<void>(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.