Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core-amqp] Handle case of ErrorEvent being passed as Error to rhea #29297

Merged
merged 3 commits into from
Apr 15, 2024

Conversation

jeremymeng
Copy link
Member

Rhea expects an Error object

https://github.com/amqp/rhea/blob/2.0.8/lib/connection.js#L591 but some times it

gets an ErrorEvent instead from certain packages, ws for example

https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L224

while rhea may be changed to unwrap the error from an ErrorEvent instance, this PR handles the ErrorEvent case in our code base since we have more control here.

Packages impacted by this PR

@azure/core-amqp

Issues associated with this PR

#29294

Rhea expects an Error object

https://github.com/amqp/rhea/blob/2.0.8/lib/connection.js#L591 but some times it

gets an ErrorEvent instead from certain packages, ws for example

https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L224

while rhea may be changed to unwrap the error from an ErrorEvent instance, this
PR handles the ErrorEvent case in our code base since we have more control here.
Comment on lines 638 to 642
let result: boolean = false;
if (typeof err.error === "object" && typeof err.message === "string") {
result = true;
}
return result;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: couldn't it be simplified as follows?

Suggested change
let result: boolean = false;
if (typeof err.error === "object" && typeof err.message === "string") {
result = true;
}
return result;
return typeof err.error === "object" && typeof err.message === "string";

@jeremymeng jeremymeng enabled auto-merge (squash) April 15, 2024 19:54
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@jeremymeng jeremymeng merged commit 3c65799 into Azure:main Apr 15, 2024
14 checks passed
@jeremymeng jeremymeng deleted the amqp/error-string branch April 15, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants