-
Notifications
You must be signed in to change notification settings - Fork 230
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
fix: Return error if subscription name already exists. #226
Conversation
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.
I think we're doing a semver major release at some point soon anyway :)
Codecov Report
@@ Coverage Diff @@
## master #226 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 10 10
Lines 807 807
=====================================
Hits 807 807
Continue to review full report at Codecov.
|
@kinwa91 lets get this in 0.20 too. |
@stephenplusplus @JustinBeckwith this was a breaking change for us, using the google bookshelf boilerplate... FYI for those experiencing the following error: I used the following snippet for promises-style. I needed to differentiate between a createSubscription object and a subscription object.
|
You can do: topic.createSubscription('my-subscription', function(err, subscription) {})
// in the future...
const subscription = topic.subscription('my-subscription')
subscription.get({ autoCreate: true }, function(err) {
// No more `ALREADY_EXISTS` error!
}) Alternatively, if you know the subscription exists, you can just start using it right away: const subscription = topic.subscription('my-subscription')
subscription.on('message', msg => {}) |
Fixes #122
This could be a breaking change, depending on if you consider this a bug that we fixed or a behavior that we switched.
Before:
After:
Here's a whole talk about some of the history: googleapis/google-cloud-node#1257