in sdk/servicebus/service-bus/src/serviceBusMessage.ts [224:275]
export function getMessagePropertyTypeMismatchError(msg: ServiceBusMessage): Error | undefined {
if (msg.contentType != null && typeof msg.contentType !== "string") {
return new TypeError("The property 'contentType' on the message must be of type 'string'");
}
if (msg.subject != null && typeof msg.subject !== "string") {
return new TypeError("The property 'label' on the message must be of type 'string'");
}
if (msg.to != null && typeof msg.to !== "string") {
return new TypeError("The property 'to' on the message must be of type 'string'");
}
if (msg.replyTo != null && typeof msg.replyTo !== "string") {
return new TypeError("The property 'replyTo' on the message must be of type 'string'");
}
if (msg.replyToSessionId != null && typeof msg.replyToSessionId !== "string") {
return new TypeError("The property 'replyToSessionId' on the message must be of type 'string'");
}
if (msg.timeToLive != null && typeof msg.timeToLive !== "number") {
return new TypeError("The property 'timeToLive' on the message must be of type 'number'");
}
if (msg.sessionId != null && typeof msg.sessionId !== "string") {
return new TypeError("The property 'sessionId' on the message must be of type 'string'");
}
if (
msg.messageId != null &&
typeof msg.messageId !== "string" &&
typeof msg.messageId !== "number" &&
!Buffer.isBuffer(msg.messageId)
) {
return new TypeError(
"The property 'messageId' on the message must be of type string, number or Buffer",
);
}
if (
msg.correlationId != null &&
typeof msg.correlationId !== "string" &&
typeof msg.correlationId !== "number" &&
!Buffer.isBuffer(msg.correlationId)
) {
return new TypeError(
"The property 'correlationId' on the message must be of type string, number or Buffer",
);
}
return;
}