From 2a1bad0e76ffaa85a8753698a07dedb6bcf47cf2 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Wed, 4 Nov 2020 14:34:07 -0800 Subject: [PATCH] adding in initial discussion fodder --- _discussion_reason_codes.md | 108 ++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 _discussion_reason_codes.md diff --git a/_discussion_reason_codes.md b/_discussion_reason_codes.md new file mode 100644 index 000000000000..cf38253de2e7 --- /dev/null +++ b/_discussion_reason_codes.md @@ -0,0 +1,108 @@ +# Service Bus: reason codes or equivalent + +## Proposal + +Each language should provide: + +- [ ] Aconceptual equivalent to a reason code (a programatically readable field describing the reason for the failure) +- [ ] A sample that shows how to use it. + +## Current state + +This is what we have: + +| Language | Error class name | Has 'reason' | Samples link | +| ---------- | ----------------------------------------- | ----------------------------------------- | -------------------------------------------------------- | +| JavaScript | [ServiceBusError][js_exception] | yes | [receiveMessagesStreaming.ts][js_sample] | +| C# | [ServiceBusException][csharp_exception] | yes | [ServiceBusProcessor(maybe, but not yet)][csharp_sample] | +| Python | [ServiceBusError(base)][python_exception] | yes, via the type of the exception itself | | +| Java | [ServiceBusException][java_exception] | no | | + +## Additional questions + +- [ ] Are users expected to react to these errors? If so, what other flags/information might we need? +- [ ] Is Java going with a base-class so users distinguish via types (like Python) or with an enum? +- [ ] Here's the current list of Reasons and their descriptions. Do we like these? Can we sync names in our code? + +```csharp + public enum ServiceBusFailureReason + { + /// + /// The exception was the result of a general error within the client library. + /// + GeneralError, + + /// + /// A Service Bus resource cannot be found by the Service Bus service. + /// + MessagingEntityNotFound, + + /// + /// The lock on the message is lost. Callers should call attempt to receive and process the message again. + /// + MessageLockLost, + + /// + /// The requested message was not found. + /// + MessageNotFound, + + /// + /// A message is larger than the maximum size allowed for its transport. + /// + MessageSizeExceeded, + + /// + /// The Messaging Entity is disabled. Enable the entity again using Portal. + /// + MessagingEntityDisabled, + + /// + /// The quota applied to an Service Bus resource has been exceeded while interacting with the Azure Service Bus service. + /// + QuotaExceeded, + + /// + /// The Azure Service Bus service reports that it is busy in response to a client request to perform an operation. + /// + ServiceBusy, + + /// + /// An operation or other request timed out while interacting with the Azure Service Bus service. + /// + ServiceTimeout, + + /// + /// There was a general communications error encountered when interacting with the Azure Service Bus service. + /// + ServiceCommunicationProblem, + + /// + /// The requested session cannot be locked. + /// + SessionCannotBeLocked, + + /// + /// The lock on the session has expired. Callers should request the session again. + /// + SessionLockLost, + + /// + /// The user doesn't have access to the entity. + /// + Unauthorized, + + /// + /// An entity with the same name exists under the same namespace. + /// + MessagingEntityAlreadyExists + } +``` + +[js_exception]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/servicebus/service-bus/src/serviceBusError.ts +[js_sample]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/servicebus/service-bus/samples/typescript/src/receiveMessagesStreaming.ts#L53 +[csharp_failurereason]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Primitives/ServiceBusFailureReason.cs#L9 +[csharp_exception]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Primitives/ServiceBusException.cs +[csharp_sample]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples/Sample04_Processor.md +[java_exception]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceiverException.java +[python_exception]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/servicebus/azure-servicebus/azure/servicebus/exceptions.py#L213