Skip to content

Commit

Permalink
refactor: anyware error passthrough (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Sep 25, 2024
1 parent 2835fcd commit d5a1fda
Show file tree
Hide file tree
Showing 59 changed files with 609 additions and 526 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
headers: Headers {
accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8',
'content-type': 'application/json',
'x-sent-at-time': '1727285962935'
'x-sent-at-time': '1727291929241'
},
signal: undefined,
method: 'post',
Expand Down
7 changes: 3 additions & 4 deletions examples/__outputs__/20_output/output_envelope.output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
{ name: 'Pikachu' },
{ name: 'Charizard' },
{ name: 'Squirtle' },
{ name: 'Bulbasaur' },
{ name: 'Nano' }
{ name: 'Bulbasaur' }
]
},
errors: undefined,
Expand All @@ -16,8 +15,8 @@
statusText: 'OK',
headers: Headers {
'content-type': 'application/graphql-response+json; charset=utf-8',
'content-length': '120',
date: 'Wed, 25 Sep 2024 17:39:23 GMT',
'content-length': '104',
date: 'Wed, 25 Sep 2024 19:18:49 GMT',
connection: 'keep-alive',
'keep-alive': 'timeout=5'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
{
errors: [
ContextualError: There was an error in the extension "anonymous" (use named functions to improve this error message) while running hook "encode".
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async Object.run (/some/path/to/main.ts:XX:XX)
at async run (/some/path/to/client.ts:XX:XX)
at async executeRootType (/some/path/to/client.ts:XX:XX)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
at async <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX) {
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
at async Object.run (/some/path/to/main.ts:XX:XX:22)
at async run (/some/path/to/client.ts:XX:XX:20)
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
at async <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:16) {
context: {
hookName: 'encode',
source: 'extension',
extensionName: 'anonymous'
},
cause: Error: Something went wrong.
at <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX)
at applyBody (/some/path/to/main.ts:XX:XX)
at <anonymous> (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:11)
at applyBody (/some/path/to/main.ts:XX:XX:28)
}
]
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/some/path/to/runPipeline.ts:76
/some/path/to/runPipeline.ts:XX:XX
return new ContextualError(message, {
^


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

Node.js vXX.XX.XX
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/some/path/to/runPipeline.ts:84
/some/path/to/runPipeline.ts:XX:XX
return new ContextualError(message, { hookName: signal.hookName, source: signal.source }, signal.error)
^


ContextualError: There was an error in the core implementation of hook "exchange".
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
... 3 lines matching cause stack trace ...
at async Object.raw (/some/path/to/client.ts:XX:XX)
at async Proxy.rawString (/some/path/to/client.ts:XX:XX)
at async <anonymous> (/some/path/to/output_preset__standard-graphql.ts:XX:XX) {
at async Object.raw (/some/path/to/client.ts:XX:XX:14)
at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14)
at async <anonymous> (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) {
context: { hookName: 'exchange', source: 'implementation' },
[cause]: TypeError: Failed to parse URL from ...
at new Request (node:internal/deps/undici/undici:XX:XX)
at Object.run (/some/path/to/core.ts:XX:XX)
at Object.run (/some/path/to/core.ts:XX:XX:29)
... 6 lines matching cause stack trace ...
at async runRaw (/some/path/to/client.ts:XX:XX)
at async Object.raw (/some/path/to/client.ts:XX:XX) {
at async runRaw (/some/path/to/client.ts:XX:XX:12)
at async Object.raw (/some/path/to/client.ts:XX:XX:14) {
[cause]: TypeError: Invalid URL
at new URL (node:internal/url:XX:XX)
at new Request (node:internal/deps/undici/undici:XX:XX)
at Object.run (/some/path/to/core.ts:XX:XX)
at runHook (/some/path/to/runHook.ts:XX:XX)
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async Object.run (/some/path/to/main.ts:XX:XX)
at async run (/some/path/to/client.ts:XX:XX)
at async runRaw (/some/path/to/client.ts:XX:XX) {
at Object.run (/some/path/to/core.ts:XX:XX:29)
at runHook (/some/path/to/runHook.ts:XX:XX:37)
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:8)
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:20)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
at async Object.run (/some/path/to/main.ts:XX:XX:22)
at async run (/some/path/to/client.ts:XX:XX:20)
at async runRaw (/some/path/to/client.ts:XX:XX:12) {
code: 'ERR_INVALID_URL',
input: '...'
}
Expand Down
16 changes: 8 additions & 8 deletions examples/__outputs__/20_output/output_return-error.output.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---------------------------------------- SHOW ----------------------------------------
ContextualError: There was an error in the extension "anonymous" (use named functions to improve this error message) while running hook "encode".
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async Object.run (/some/path/to/main.ts:XX:XX)
at async run (/some/path/to/client.ts:XX:XX)
at async executeRootType (/some/path/to/client.ts:XX:XX)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
at async <anonymous> (/some/path/to/output_return-error.ts:XX:XX) {
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
at async Object.run (/some/path/to/main.ts:XX:XX:22)
at async run (/some/path/to/client.ts:XX:XX:20)
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
at async <anonymous> (/some/path/to/output_return-error.ts:XX:XX:18) {
context: {
hookName: 'encode',
source: 'extension',
extensionName: 'anonymous'
},
cause: Error: Something went wrong.
at <anonymous> (/some/path/to/output_return-error.ts:XX:XX)
at applyBody (/some/path/to/main.ts:XX:XX)
at <anonymous> (/some/path/to/output_return-error.ts:XX:XX:11)
at applyBody (/some/path/to/main.ts:XX:XX:28)
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---------------------------------------- SHOW ----------------------------------------
ContextualAggregateError: One or more errors in the execution result.
at handleOutput (/some/path/to/handleOutput.ts:XX:XX)
at run (/some/path/to/client.ts:XX:XX)
at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19)
at run (/some/path/to/client.ts:XX:XX:12)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
at async executeRootType (/some/path/to/client.ts:XX:XX)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX) {
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:16) {
context: {},
cause: undefined,
errors: [
Expand All @@ -22,12 +22,12 @@ ContextualAggregateError: One or more errors in the execution result.
]
}
]
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX)
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX:47)
at Array.map (<anonymous>)
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX)
at Object.unpack (/some/path/to/core.ts:XX:XX)
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28)
at Object.unpack (/some/path/to/core.ts:XX:XX:26)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
at async runHook (/some/path/to/runHook.ts:XX:XX) {
at async runHook (/some/path/to/runHook.ts:XX:XX:16) {
path: [ 'addPokemon' ],
locations: undefined,
extensions: [Object: null prototype] {}
Expand All @@ -36,20 +36,20 @@ ContextualAggregateError: One or more errors in the execution result.
}
---------------------------------------- SHOW ----------------------------------------
ContextualError: There was an error in the extension "anonymous" (use named functions to improve this error message) while running hook "encode".
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
at async Object.run (/some/path/to/main.ts:XX:XX)
at async run (/some/path/to/client.ts:XX:XX)
at async executeRootType (/some/path/to/client.ts:XX:XX)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX)
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX) {
at async Object.run (/some/path/to/main.ts:XX:XX:22)
at async run (/some/path/to/client.ts:XX:XX:20)
at async executeRootType (/some/path/to/client.ts:XX:XX:12)
at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20)
at async <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:3) {
context: {
hookName: 'encode',
source: 'extension',
extensionName: 'anonymous'
},
cause: Error: Something went wrong.
at <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX)
at applyBody (/some/path/to/main.ts:XX:XX)
at <anonymous> (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:13)
at applyBody (/some/path/to/main.ts:XX:XX:28)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/some/path/to/handleOutput.ts:60
/some/path/to/handleOutput.ts:XX:XX
const error = new Errors.ContextualAggregateError(
^


ContextualAggregateError: One or more errors in the execution result.
at handleOutput (/some/path/to/handleOutput.ts:XX:XX)
at run (/some/path/to/client.ts:XX:XX)
at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19)
at run (/some/path/to/client.ts:XX:XX:12)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
at async runRaw (/some/path/to/client.ts:XX:XX)
at async Proxy.raw (/some/path/to/client.ts:XX:XX)
at async <anonymous> (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX) {
at async runRaw (/some/path/to/client.ts:XX:XX:12)
at async Proxy.raw (/some/path/to/client.ts:XX:XX:14)
at async <anonymous> (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX:14) {
context: {},
cause: undefined,
errors: [
GraphQLError: Cannot query field "continent" on type "Pokemon".
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX)
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX:47)
at Array.map (<anonymous>)
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX)
at Object.unpack (/some/path/to/core.ts:XX:XX)
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28)
at Object.unpack (/some/path/to/core.ts:XX:XX:26)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
at async runHook (/some/path/to/runHook.ts:XX:XX) {
at async runHook (/some/path/to/runHook.ts:XX:XX:16) {
path: undefined,
locations: undefined,
extensions: [Object: null prototype] {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
{ name: 'Squirtle' },
{ name: 'Bulbasaur' }
]
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/some/path/to/runPipeline.ts:84
/some/path/to/runPipeline.ts:XX:XX
return new ContextualError(message, { hookName: signal.hookName, source: signal.source }, signal.error)
^


ContextualError: There was an error in the core implementation of hook "pack".
at runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX)
at async Object.run (/some/path/to/main.ts:XX:XX)
at async run (/some/path/to/client.ts:XX:XX)
at async runRaw (/some/path/to/client.ts:XX:XX)
at async Object.raw (/some/path/to/client.ts:XX:XX)
at async Proxy.rawString (/some/path/to/client.ts:XX:XX)
at async <anonymous> (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX) {
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14)
at async Object.run (/some/path/to/main.ts:XX:XX:22)
at async run (/some/path/to/client.ts:XX:XX:20)
at async runRaw (/some/path/to/client.ts:XX:XX:12)
at async Object.raw (/some/path/to/client.ts:XX:XX:14)
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:16) {
context: { hookName: 'pack', source: 'implementation' },
cause: Error: Unexpected null value.
at throwNull (/some/path/to/prelude.ts:XX:XX)
at Object.run (/some/path/to/core.ts:XX:XX)
at runHook (/some/path/to/runHook.ts:XX:XX)
at <anonymous> (/some/path/to/runHook.ts:XX:XX)
at <anonymous> (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX)
at applyBody (/some/path/to/main.ts:XX:XX)
at throwNull (/some/path/to/prelude.ts:XX:XX:29)
at Object.run (/some/path/to/core.ts:XX:XX:35)
at runHook (/some/path/to/runHook.ts:XX:XX:37)
at <anonymous> (/some/path/to/runHook.ts:XX:XX:14)
at <anonymous> (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX:18)
at applyBody (/some/path/to/main.ts:XX:XX:28)
}

Node.js vXX.XX.XX
Loading

0 comments on commit d5a1fda

Please sign in to comment.