Skip to content

Commit

Permalink
improve error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj Keshri committed Feb 8, 2025
1 parent fb6e2ab commit d6c910d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-elephants-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"graphql-eventbus": patch
---

error log
26 changes: 26 additions & 0 deletions packages/core/src/GraphQLEventbus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,17 @@ export class GraphQLEventbus {
);
}
} catch (e) {
console.error(
"Consume failed for the payload ",
JSON.stringify(
{
topic,
data: baggage.payload,
},
null,
2,
),
);
if (consumeErrorHooks.length) {
await Promise.all(
consumeErrorHooks.map((hook) => {
Expand Down Expand Up @@ -306,6 +317,21 @@ export class GraphQLEventbus {
);
}
} catch (e) {
console.error(
"Publish failed for the payload ",
JSON.stringify(
{
topic: props.topic,
baggage: {
metadata,
payload: props.payload,
},
extra: props.extra,
},
null,
2,
),
);
if (publishErrorHooks.length) {
await Promise.all(
publishErrorHooks.map((hook) => {
Expand Down

0 comments on commit d6c910d

Please sign in to comment.