Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] MessagingError changes #6673
[core-amqp] MessagingError changes #6673
Changes from all commits
b1c9f1c
2c7f284
492cd3d
f32a0fb
5af083b
11baf23
8fb7291
6244996
ea9082f
c037379
7566a3e
14fb58c
3a80222
b701519
e5f327f
fb5dcea
04cfa22
1f95274
270fcf4
1d7fa5a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if by this point we don't have a
code
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point I was treating errors without a code as neither an
AmqpError
nor aSystemError
, so do not alter them. They currently don't have aretryable
field so are effectively not retryable.This could change based on the thread you started at https://github.com/Azure/azure-sdk-for-js/pull/6673/files#r362364248
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While
isAmqpError()
ensures that the error has the condition property, we still won't have acode
if there was an error with an amqp condition for which we have no mapping. Such errors will be treated as retryable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, if there isn't a code, we will treat the error as retryable since retryable is set to true in the MessagingError constructor and we don't change it to false here. That seems consistent with the behavior prior to this PR, since if no condition was found we'd set the
name
toMessagingError
, and any error with the nameMessagingError
was treated as retryable.So, I think the question you're getting at is whether we should set
error.code
if there is no mapping or not. My preference would be to not do this, because then it would be a breaking change if we wanted to change the code in the future for an error we learned more about but weren't handling before. I think we can safely add a code if it never existed in the 1st place, but not change it if there already was one for an error.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not true...
retryableErrors
would not have an entry forMessagingError
and soretryable
would be set to false...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azure-sdk-for-js/sdk/core/core-amqp/src/errors.ts
Line 490 in 4b0f3ad
retryableErrors does have an entry for MessagingError today though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah! I missed that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idle speculation: if this cast is valid, then perhaps
code
could be typed askeyof typeof SystemErrorConditionMapper
to begin with?