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

[service-bus] Design discussion for error reporting #12286

Closed

Conversation

richardpark-msft
Copy link
Member

No description provided.

@richardpark-msft richardpark-msft added the design-discussion An area of design currently under discussion and open to team and community feedback. label Nov 4, 2020
@richardpark-msft richardpark-msft changed the title [service-bus] Design discussion [service-bus] Design discussion for error reporting Nov 4, 2020
/// <summary>
/// The user doesn't have access to the entity.
/// </summary>
Unauthorized,
Copy link
Member

Choose a reason for hiding this comment

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

This may be worthy of discussion. Feedback during Event Hubs was that we should use the natural exception in the language, if one applies. In this case, we were asked to use an UnauthorizedAccessException. which is also the behavior from the EH and SB clients in Track One.

Since we're using language types like ArgumentException, ArgumentOutOfRangeException, InvalidOperationException, and NotSupportedException rather than wrapping them in ServiceBusException, is there a reason that we don't want to do the same for the unauthorized scenario?

Copy link
Member

Choose a reason for hiding this comment

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

Track 1 uses a custom UnathorizedException that derives from ServiceBusException.
I think the distinction of when we use ServiceBusException is when the exception actually comes from the service.

Copy link
Member

Choose a reason for hiding this comment

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

Except for the other ones that I mentioned, which are in the AMQP mapping but go to standard language types. 😄

Copy link
Member

@JoshLove-msft JoshLove-msft Nov 5, 2020

Choose a reason for hiding this comment

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

Fair point - I assumed you were referring to the client side validation, but you are right - sometimes we wrap service errors in standard language exceptions.

Copy link
Member

Choose a reason for hiding this comment

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

Personally, I don't feel strongly. Krzysztof did, at one point any may have guidance here.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think we should probably be consistent here for .NET.

Copy link
Member Author

Choose a reason for hiding this comment

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

@KieranBrantnerMagee , I'm guessing that Python might have a similar concern but I don't know if there's a stdlib type exception that would cover this case (so you would have to make your own anyways).

Copy link
Member Author

Choose a reason for hiding this comment

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

@JoshLove-msft - and for my own curiosity - are you saying you're going to swap over to using your native language exception here? I believe this change would only affect .net. @hemanttanwar - does Java have a similar built-in exception for this as well?

Copy link
Member

Choose a reason for hiding this comment

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

Correct - there is no reason to differ from EH here, especially when we are already using native language exceptions for some service errors. If we were going to be consistent and always use SBException/EHException for service errors, it would be a different story.


## Additional questions

- [ ] Are users expected to react to these errors? If so, what other flags/information might we need?
Copy link
Member

@jsquire jsquire Nov 5, 2020

Choose a reason for hiding this comment

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

The attributes that I see as important are:

  • IsTransient : Offers a hint to users if retrying may resolve the issue; also offers a hint to understand if the client has already retried according to its policy.

  • Message: What in the wide, wide world of sports is a-goin' on around here? (This is driven by the service response, when triggered as part of communication)

One that I've heard asked for and discussed that I think we should avoid:

  • WhoseFault: An indication of "this was caused by something the user did" versus "this is just something that happened". While it is potentially helpful, the service does not give a clear indication of this and I do not believe the client should be attempting to interpret and classify the service response this way. If the service begins to return this, then yeah.... we should surface it.

Copy link
Member

Choose a reason for hiding this comment

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

For the isTransient, how would we know if it is a transient issue if we pass on the error as soon as it is encountered?

Copy link
Member

Choose a reason for hiding this comment

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

If you do not retry, it's not transient. If you do.... 😄

Copy link
Member

Choose a reason for hiding this comment

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

We do have the retryable flag for that! :)

Copy link
Member

Choose a reason for hiding this comment

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

Retryable = IsTransient

Copy link

Choose a reason for hiding this comment

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

Don't you mean Retriable? 😉

@richardpark-msft
Copy link
Member Author

@chradek - any conflicts you see with what Event Hubs does? We're basically being additive with the reason code (and even then, this is only currently in service bus). But I'm guessing we'd want to potentially expose this there as well.

@chradek
Copy link
Contributor

chradek commented Nov 6, 2020

@richardpark-msft
Not specific to event hubs, but core-amqp uses code instead of reason to distinguish MessagingErrors. I think we chose code partially because many errors thrown from the node.js runtime have a code field that users can check against.

I can't help but notice that many of the errors listed in the enum here match what we have in core-amqp, and as a user I'd probably be confused if I sometimes saw MessageLockLostError in code and sometimes in reason depending whether it was core-amqp or service-bus that threw the error :)

Other than that, looks reasonable to me!

@richardpark-msft
Copy link
Member Author

@richardpark-msft
Not specific to event hubs, but core-amqp uses code instead of reason to distinguish MessagingErrors. I think we chose code partially because many errors thrown from the node.js runtime have a code field that users can check against.

I can't help but notice that many of the errors listed in the enum here match what we have in core-amqp, and as a user I'd probably be confused if I sometimes saw MessageLockLostError in code and sometimes in reason depending whether it was core-amqp or service-bus that threw the error :)

Other than that, looks reasonable to me!

Yeah, it's definitely a reasonable concern.

In the documentation the only spot they can really see a list of checkable codes will be on the reason field (the '.code' field is just a string) but if they were just inspecting the actual data that's passed to them there definitely could be that confusion.

We do demonstrate how to do error checking in our receiveMessagesStreaming sample so I think we'll be okay.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Nov 12, 2020

Update:

image

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jan 12, 2021
Adding default values to fix correctness issue (Azure#12286)

* Adding default values to fix correctness issue

* revoke default value for allowedOrigins
@richardpark-msft
Copy link
Member Author

The discussion on this has long since passed and we shipped the result of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-discussion An area of design currently under discussion and open to team and community feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants