fix: Return error if subscription name already exists.#226
Conversation
JustinBeckwith
left a comment
There was a problem hiding this comment.
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