Skip to content

Commit d5a1fda

Browse files
authored
refactor: anyware error passthrough (#1127)
1 parent 2835fcd commit d5a1fda

File tree

59 files changed

+609
-526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+609
-526
lines changed

examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
headers: Headers {
55
accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8',
66
'content-type': 'application/json',
7-
'x-sent-at-time': '1727285962935'
7+
'x-sent-at-time': '1727291929241'
88
},
99
signal: undefined,
1010
method: 'post',

examples/__outputs__/20_output/output_envelope.output.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
{ name: 'Pikachu' },
66
{ name: 'Charizard' },
77
{ name: 'Squirtle' },
8-
{ name: 'Bulbasaur' },
9-
{ name: 'Nano' }
8+
{ name: 'Bulbasaur' }
109
]
1110
},
1211
errors: undefined,
@@ -16,8 +15,8 @@
1615
statusText: 'OK',
1716
headers: Headers {
1817
'content-type': 'application/graphql-response+json; charset=utf-8',
19-
'content-length': '120',
20-
date: 'Wed, 25 Sep 2024 17:39:23 GMT',
18+
'content-length': '104',
19+
date: 'Wed, 25 Sep 2024 19:18:49 GMT',
2120
connection: 'keep-alive',
2221
'keep-alive': 'timeout=5'
2322
},

examples/__outputs__/20_output/output_envelope_envelope-error__envelope-error.output.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
{
33
errors: [
44
ContextualError: There was an error in the extension "anonymous" (use named functions to improve this error message) while running hook "encode".
5-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
6-
at async Object.run (/some/path/to/main.ts:XX:XX)
7-
at async run (/some/path/to/client.ts:XX:XX)
8-
at async executeRootType (/some/path/to/client.ts:XX:XX)
9-
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
10-
at async <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX) {
5+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
6+
at async Object.run (/some/path/to/main.ts:XX:XX:22)
7+
at async run (/some/path/to/client.ts:XX:XX:20)
8+
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
9+
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
10+
at async <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:16) {
1111
context: {
1212
hookName: 'encode',
1313
source: 'extension',
1414
extensionName: 'anonymous'
1515
},
1616
cause: Error: Something went wrong.
17-
at <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX)
18-
at applyBody (/some/path/to/main.ts:XX:XX)
17+
at <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:11)
18+
at applyBody (/some/path/to/main.ts:XX:XX:28)
1919
}
2020
]
2121
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
/some/path/to/runPipeline.ts:76
1+
/some/path/to/runPipeline.ts:XX:XX
22
return new ContextualError(message, {
33
^
44

55

66
ContextualError: There was an error in the extension "anonymous" (use named functions to improve this error message) while running hook "encode".
7-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
8-
at async Object.run (/some/path/to/main.ts:XX:XX)
9-
at async run (/some/path/to/client.ts:XX:XX)
10-
at async executeRootType (/some/path/to/client.ts:XX:XX)
11-
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
12-
at async <anonymous> (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX) {
7+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
8+
at async Object.run (/some/path/to/main.ts:XX:XX:22)
9+
at async run (/some/path/to/client.ts:XX:XX:20)
10+
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
11+
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
12+
at async <anonymous> (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX:1) {
1313
context: {
1414
hookName: 'encode',
1515
source: 'extension',
1616
extensionName: 'anonymous'
1717
},
1818
cause: Error: Something went wrong.
19-
at <anonymous> (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX)
20-
at applyBody (/some/path/to/main.ts:XX:XX)
19+
at <anonymous> (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX:11)
20+
at applyBody (/some/path/to/main.ts:XX:XX:28)
2121
}
2222

2323
Node.js vXX.XX.XX

examples/__outputs__/20_output/output_preset__standard-graphql.output.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
/some/path/to/runPipeline.ts:84
1+
/some/path/to/runPipeline.ts:XX:XX
22
return new ContextualError(message, { hookName: signal.hookName, source: signal.source }, signal.error)
33
^
44

55

66
ContextualError: There was an error in the core implementation of hook "exchange".
7-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
8-
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
9-
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
7+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
8+
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
9+
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
1010
... 3 lines matching cause stack trace ...
11-
at async Object.raw (/some/path/to/client.ts:XX:XX)
12-
at async Proxy.rawString (/some/path/to/client.ts:XX:XX)
13-
at async <anonymous> (/some/path/to/output_preset__standard-graphql.ts:XX:XX) {
11+
at async Object.raw (/some/path/to/client.ts:XX:XX:14)
12+
at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14)
13+
at async <anonymous> (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) {
1414
context: { hookName: 'exchange', source: 'implementation' },
1515
[cause]: TypeError: Failed to parse URL from ...
1616
at new Request (node:internal/deps/undici/undici:XX:XX)
17-
at Object.run (/some/path/to/core.ts:XX:XX)
17+
at Object.run (/some/path/to/core.ts:XX:XX:29)
1818
... 6 lines matching cause stack trace ...
19-
at async runRaw (/some/path/to/client.ts:XX:XX)
20-
at async Object.raw (/some/path/to/client.ts:XX:XX) {
19+
at async runRaw (/some/path/to/client.ts:XX:XX:12)
20+
at async Object.raw (/some/path/to/client.ts:XX:XX:14) {
2121
[cause]: TypeError: Invalid URL
2222
at new URL (node:internal/url:XX:XX)
2323
at new Request (node:internal/deps/undici/undici:XX:XX)
24-
at Object.run (/some/path/to/core.ts:XX:XX)
25-
at runHook (/some/path/to/runHook.ts:XX:XX)
26-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
27-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
28-
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
29-
at async Object.run (/some/path/to/main.ts:XX:XX)
30-
at async run (/some/path/to/client.ts:XX:XX)
31-
at async runRaw (/some/path/to/client.ts:XX:XX) {
24+
at Object.run (/some/path/to/core.ts:XX:XX:29)
25+
at runHook (/some/path/to/runHook.ts:XX:XX:37)
26+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:8)
27+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:20)
28+
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
29+
at async Object.run (/some/path/to/main.ts:XX:XX:22)
30+
at async run (/some/path/to/client.ts:XX:XX:20)
31+
at async runRaw (/some/path/to/client.ts:XX:XX:12) {
3232
code: 'ERR_INVALID_URL',
3333
input: '...'
3434
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---------------------------------------- SHOW ----------------------------------------
22
ContextualError: There was an error in the extension "anonymous" (use named functions to improve this error message) while running hook "encode".
3-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
4-
at async Object.run (/some/path/to/main.ts:XX:XX)
5-
at async run (/some/path/to/client.ts:XX:XX)
6-
at async executeRootType (/some/path/to/client.ts:XX:XX)
7-
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
8-
at async <anonymous> (/some/path/to/output_return-error.ts:XX:XX) {
3+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
4+
at async Object.run (/some/path/to/main.ts:XX:XX:22)
5+
at async run (/some/path/to/client.ts:XX:XX:20)
6+
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
7+
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
8+
at async <anonymous> (/some/path/to/output_return-error.ts:XX:XX:18) {
99
context: {
1010
hookName: 'encode',
1111
source: 'extension',
1212
extensionName: 'anonymous'
1313
},
1414
cause: Error: Something went wrong.
15-
at <anonymous> (/some/path/to/output_return-error.ts:XX:XX)
16-
at applyBody (/some/path/to/main.ts:XX:XX)
15+
at <anonymous> (/some/path/to/output_return-error.ts:XX:XX:11)
16+
at applyBody (/some/path/to/main.ts:XX:XX:28)
1717
}
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---------------------------------------- SHOW ----------------------------------------
22
ContextualAggregateError: One or more errors in the execution result.
3-
at handleOutput (/some/path/to/handleOutput.ts:XX:XX)
4-
at run (/some/path/to/client.ts:XX:XX)
3+
at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19)
4+
at run (/some/path/to/client.ts:XX:XX:12)
55
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
6-
at async executeRootType (/some/path/to/client.ts:XX:XX)
7-
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
8-
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX) {
6+
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
7+
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
8+
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:16) {
99
context: {},
1010
cause: undefined,
1111
errors: [
@@ -22,12 +22,12 @@ ContextualAggregateError: One or more errors in the execution result.
2222
]
2323
}
2424
]
25-
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX)
25+
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX:47)
2626
at Array.map (<anonymous>)
27-
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX)
28-
at Object.unpack (/some/path/to/core.ts:XX:XX)
27+
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28)
28+
at Object.unpack (/some/path/to/core.ts:XX:XX:26)
2929
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
30-
at async runHook (/some/path/to/runHook.ts:XX:XX) {
30+
at async runHook (/some/path/to/runHook.ts:XX:XX:16) {
3131
path: [ 'addPokemon' ],
3232
locations: undefined,
3333
extensions: [Object: null prototype] {}
@@ -36,20 +36,20 @@ ContextualAggregateError: One or more errors in the execution result.
3636
}
3737
---------------------------------------- SHOW ----------------------------------------
3838
ContextualError: There was an error in the extension "anonymous" (use named functions to improve this error message) while running hook "encode".
39-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
39+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
4040
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
41-
at async Object.run (/some/path/to/main.ts:XX:XX)
42-
at async run (/some/path/to/client.ts:XX:XX)
43-
at async executeRootType (/some/path/to/client.ts:XX:XX)
44-
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
45-
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX) {
41+
at async Object.run (/some/path/to/main.ts:XX:XX:22)
42+
at async run (/some/path/to/client.ts:XX:XX:20)
43+
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
44+
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
45+
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:3) {
4646
context: {
4747
hookName: 'encode',
4848
source: 'extension',
4949
extensionName: 'anonymous'
5050
},
5151
cause: Error: Something went wrong.
52-
at <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX)
53-
at applyBody (/some/path/to/main.ts:XX:XX)
52+
at <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:13)
53+
at applyBody (/some/path/to/main.ts:XX:XX:28)
5454
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
5555
}

examples/__outputs__/30_raw/raw_rawDocumentNode__raw-document-node.output.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
/some/path/to/handleOutput.ts:60
1+
/some/path/to/handleOutput.ts:XX:XX
22
const error = new Errors.ContextualAggregateError(
33
^
44

55

66
ContextualAggregateError: One or more errors in the execution result.
7-
at handleOutput (/some/path/to/handleOutput.ts:XX:XX)
8-
at run (/some/path/to/client.ts:XX:XX)
7+
at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19)
8+
at run (/some/path/to/client.ts:XX:XX:12)
99
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
10-
at async runRaw (/some/path/to/client.ts:XX:XX)
11-
at async Proxy.raw (/some/path/to/client.ts:XX:XX)
12-
at async <anonymous> (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX) {
10+
at async runRaw (/some/path/to/client.ts:XX:XX:12)
11+
at async Proxy.raw (/some/path/to/client.ts:XX:XX:14)
12+
at async <anonymous> (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX:14) {
1313
context: {},
1414
cause: undefined,
1515
errors: [
1616
GraphQLError: Cannot query field "continent" on type "Pokemon".
17-
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX)
17+
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX:47)
1818
at Array.map (<anonymous>)
19-
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX)
20-
at Object.unpack (/some/path/to/core.ts:XX:XX)
19+
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28)
20+
at Object.unpack (/some/path/to/core.ts:XX:XX:26)
2121
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
22-
at async runHook (/some/path/to/runHook.ts:XX:XX) {
22+
at async runHook (/some/path/to/runHook.ts:XX:XX:16) {
2323
path: undefined,
2424
locations: undefined,
2525
extensions: [Object: null prototype] {}

examples/__outputs__/50_anyware/anyware_slot_slot-body__slot-body.output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
{ name: 'Squirtle' },
77
{ name: 'Bulbasaur' }
88
]
9-
}
9+
}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
/some/path/to/runPipeline.ts:84
1+
/some/path/to/runPipeline.ts:XX:XX
22
return new ContextualError(message, { hookName: signal.hookName, source: signal.source }, signal.error)
33
^
44

55

66
ContextualError: There was an error in the core implementation of hook "pack".
7-
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
8-
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
9-
at async Object.run (/some/path/to/main.ts:XX:XX)
10-
at async run (/some/path/to/client.ts:XX:XX)
11-
at async runRaw (/some/path/to/client.ts:XX:XX)
12-
at async Object.raw (/some/path/to/client.ts:XX:XX)
13-
at async Proxy.rawString (/some/path/to/client.ts:XX:XX)
14-
at async <anonymous> (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX) {
7+
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
8+
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
9+
at async Object.run (/some/path/to/main.ts:XX:XX:22)
10+
at async run (/some/path/to/client.ts:XX:XX:20)
11+
at async runRaw (/some/path/to/client.ts:XX:XX:12)
12+
at async Object.raw (/some/path/to/client.ts:XX:XX:14)
13+
at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14)
14+
at async <anonymous> (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX:16) {
1515
context: { hookName: 'pack', source: 'implementation' },
1616
cause: Error: Unexpected null value.
17-
at throwNull (/some/path/to/prelude.ts:XX:XX)
18-
at Object.run (/some/path/to/core.ts:XX:XX)
19-
at runHook (/some/path/to/runHook.ts:XX:XX)
20-
at <anonymous> (/some/path/to/runHook.ts:XX:XX)
21-
at <anonymous> (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX)
22-
at applyBody (/some/path/to/main.ts:XX:XX)
17+
at throwNull (/some/path/to/prelude.ts:XX:XX:29)
18+
at Object.run (/some/path/to/core.ts:XX:XX:35)
19+
at runHook (/some/path/to/runHook.ts:XX:XX:37)
20+
at <anonymous> (/some/path/to/runHook.ts:XX:XX:14)
21+
at <anonymous> (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX:18)
22+
at applyBody (/some/path/to/main.ts:XX:XX:28)
2323
}
2424

2525
Node.js vXX.XX.XX

0 commit comments

Comments
 (0)