Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,18 @@ export function traceMixed<TResult, TContext extends TraceLifecycleContext>(
}

channel.end.publish(context);
channel.asyncStart.publish(context);

return result.then(
(value) => {
context.result = value;
channel.asyncStart.publish(context);
channel.asyncEnd.publish(context);
return value;
},
(err: unknown) => {
context.error = err;
channel.error.publish(context);
channel.asyncStart.publish(context);
channel.asyncEnd.publish(context);
throw err;
},
Expand Down
7 changes: 5 additions & 2 deletions src/execution/__tests__/diagnostics-execute-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ describe('execute diagnostics channel', () => {
rawVariableValues: undefined,
operationName: undefined,
operationType: OperationTypeNode.QUERY,
result,
},
},
{
Expand Down Expand Up @@ -201,17 +202,18 @@ describe('execute diagnostics channel', () => {
},
},
{
channel: 'asyncStart',
channel: 'error',
context: {
schema: asyncDeferSchema,
document,
rawVariableValues: undefined,
operationName: 'Deferred',
operationType: OperationTypeNode.QUERY,
error,
},
},
{
channel: 'error',
channel: 'asyncStart',
context: {
schema: asyncDeferSchema,
document,
Expand Down Expand Up @@ -456,6 +458,7 @@ describe('execute root selection set diagnostics channel', () => {
rawVariableValues: undefined,
operationName: undefined,
operationType: OperationTypeNode.QUERY,
result,
},
},
{
Expand Down
7 changes: 5 additions & 2 deletions src/execution/__tests__/diagnostics-resolve-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe('resolve diagnostics channel', () => {
args: {},
isDefaultResolver: true,
fieldPath: 'async',
result: 'hello-async',
},
},
{
Expand Down Expand Up @@ -207,6 +208,7 @@ describe('resolve diagnostics channel', () => {
args: {},
isDefaultResolver: true,
fieldPath: 'async',
result: 'hello-thenable',
},
},
{
Expand Down Expand Up @@ -325,7 +327,7 @@ describe('resolve diagnostics channel', () => {
},
},
{
channel: 'asyncStart',
channel: 'error',
context: {
fieldName: 'asyncFail',
alias: 'asyncFail',
Expand All @@ -334,10 +336,11 @@ describe('resolve diagnostics channel', () => {
args: {},
isDefaultResolver: true,
fieldPath: 'asyncFail',
error,
},
},
{
channel: 'error',
channel: 'asyncStart',
context: {
fieldName: 'asyncFail',
alias: 'asyncFail',
Expand Down
2 changes: 2 additions & 0 deletions src/execution/__tests__/diagnostics-subscribe-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ describe('subscribe diagnostics channel', () => {
rawVariableValues: undefined,
operationName: undefined,
operationType: OperationTypeNode.SUBSCRIPTION,
result,
},
},
{
Expand Down Expand Up @@ -474,6 +475,7 @@ describe('subscribe diagnostics channel', () => {
rawVariableValues: undefined,
operationName: 'S',
operationType: OperationTypeNode.SUBSCRIPTION,
result,
},
},
{
Expand Down
Loading