Skip to content

Commit

Permalink
fix: log issue with non-json payload, #6
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierchow committed Mar 29, 2022
1 parent 47b78f7 commit b4820c2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/responder/inbound-message-deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ export class InboundMessageDeserializer implements ConsumerDeserializer {
private readonly logger = new Logger('InboundMessageIdentityDeserializer');

deserialize(value: any, options?: Record<string, any>): IncomingRequest {
let msg;
let json;

try {
msg = value.json();
} catch (err) {
msg = value;
}
json = value.json();
} catch (err) {}

this.logger.verbose(
`<<-- deserializing inbound message:\n
${JSON.stringify(msg)}
${(json && JSON.stringify(json)) || value.body}
\n\twith options: ${JSON.stringify(options)}`,
);

return {
id: msg.id,
data: msg,
id: value.id,
data: json || value.body,
pattern: options,
};
}
Expand Down

0 comments on commit b4820c2

Please sign in to comment.