Skip to content

Commit 4d2decc

Browse files
committed
More error debugging in dev setup
1 parent c4dafd4 commit 4d2decc

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

postgraphile/postgraphile/graphile.config.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ const preset: GraphileConfig.Preset = {
431431
}
432432
extend type Subscription {
433433
sub(topic: String!): Int
434-
gql: Int
434+
gql(max: Int! = 10): Int
435435
slow: String
436436
}
437437
`,
@@ -469,8 +469,8 @@ const preset: GraphileConfig.Preset = {
469469
),
470470
subscribe: EXPORTABLE(
471471
(sleep) =>
472-
async function* subscribe() {
473-
for (let i = 0; i < 10; i++) {
472+
async function* subscribe(_, { max }) {
473+
for (let i = 1; i <= max; i++) {
474474
yield i;
475475
await sleep(300);
476476
}
@@ -506,6 +506,7 @@ const preset: GraphileConfig.Preset = {
506506
typeDefs: /* GraphQL */ `
507507
extend type Subscription {
508508
error: Int
509+
errorAfter(n: Int! = 3): Int
509510
}
510511
`,
511512
objects: {
@@ -522,6 +523,26 @@ const preset: GraphileConfig.Preset = {
522523
[constant, lambda],
523524
),
524525
},
526+
errorAfter: {
527+
subscribe: EXPORTABLE(
528+
(sleep) =>
529+
async function* subscribe(_, { n }) {
530+
for (let i = 0; i < n; i++) {
531+
yield i;
532+
await sleep(1000);
533+
}
534+
throw new Error(`Error after ${n}`);
535+
},
536+
[sleep],
537+
),
538+
resolve: EXPORTABLE(
539+
() =>
540+
function resolve(i) {
541+
return i;
542+
},
543+
[],
544+
),
545+
},
525546
},
526547
},
527548
},

postgraphile/postgraphile/watch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ yarn nodemon \
1111
--watch "../../utils/*/dist/**/*" \
1212
--watch "../../grafast/ruru/bundle/**/*" \
1313
--watch "../../contrib/*/dist/**/*" \
14-
-x "node --enable-source-maps dist/cli-run.js --watch $*"
14+
-x "node --enable-source-maps --async-stack-traces --unhandled-rejections=strict --trace-uncaught dist/cli-run.js --watch $*"

0 commit comments

Comments
 (0)