Skip to content

Commit 7c1e4d9

Browse files
committed
fix(index): handle error when posting new tags
Previous behavior was based on the use of `Q.allSettled`, which does not distinguish between a successful promise, or a rejected promise. Therefore, even if `conventional-gitlab-releaser` failed to post a new GitLab Release page, `conventional-gitlab-releaser` would still call the callback without an error, thereby causing consumers to assume everything succeeded. New behavior is based on the use of `Q.all`, which will distinguish between a fulfilled promise and a rejected promise. Therefore we can register a `then` callback for success, and a `catch` callback to handle the first promise that fails. Concern: Because we make POST requests for new tags concurrently, some tags, and their respective Release pages, may be successfully created on GitLab, yet `conventional-gitlab-releaser` could still report failure if even a single POST request fails. That could leave the process of creating tags in an undesired state. Long-term, perhaps we should cleanup all created tags if a single request fails so that we leave the target project in a clean state. (Though we need to also consider that tag creation may automatically trigger other downstream processes; such as CI). Fixes #3
1 parent 9a18c37 commit 7c1e4d9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ function conventionalGithubReleaser(auth, changelogOpts, context, gitRawCommitsO
100100

101101
cb();
102102
}, function() {
103-
Q.allSettled(promises)
103+
Q.all(promises)
104104
.then(function(responses) {
105-
setImmediate(userCb, null, responses);
105+
userCb(null, responses);
106+
})
107+
.catch(function(err) {
108+
userCb(err);
106109
});
107110
}));
108111
})

0 commit comments

Comments
 (0)