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] Updating receiveMessagesStreaming sample to showcase proper error handling #12111

Merged

Conversation

richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Oct 28, 2020

As part of our changes to make the subscribe() internals more robust (and more forgiving of errors) we need to update our sample.

The sample should now show how to handle errors, since we've now returned control to the user as to what is considered fatal.

Some other changes:

  • I've also updated the isMessagingError and MessagingError definitions to make it simpler to get good type checking on the constants while still being backwards compatible for users that were already referencing MessagingError (isMessagingError, being new, does not have this constraint)
  • Quite a few of our samples were actually broken so those have also been updated.

Fixes #12051, #8653, #7905

- Syncing the javascript and typescript samples so they have 99% of the same formatting to make the next sync easier.
1. Make it so you can narrow the type ofr 'code' so you can get useful autocomplete information.

By default `isMessagingError` (which is new to this release) returns MessagingError's that are strictly typed (with an option to get the more loosely typed version that takes a 'string' for the .code field).

MessagingError itself (when no type parameter is specified) defaults to what it was previously - just a string.

So this change should be backwards compatible.

2. I've added in proper doc comments for the various error codes and alphabetized them. There's a _lot_ but at least this makes it easier to scan and find the one you want. Our samples in ServiceBus will clarify which of these codes are likely to be relevant for most users.
…nd the underlying defined string union as well.
- api file needed updating since I rearranged the members of the string union.
@richardpark-msft
Copy link
Member Author

@HarshaNalluru , @ramya-rao-a - JavaScript receiveStreamingMessages sample to come after we finish reviewing the typescript version. (also, still testing but wanted to see if the structure of the sample made sense).

Adding in some more comment text to illustrate where you can turn off autocomplete.
@ramya-rao-a
Copy link
Contributor

/azp run js - core - ci

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@richardpark-msft richardpark-msft merged commit 88ae7db into Azure:master Oct 29, 2020
@richardpark-msft richardpark-msft deleted the richardpark-sb-foreverloop branch October 29, 2020 20:56
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.

Azure Service Bus Samples Issues
4 participants