Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit f56a6be

Browse files
author
Axel Rindle
committed
Apply "errorfirst" convention
1 parent a7437e2 commit f56a6be

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

examples/callback.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const options = {
1212
currentVersion: require('../package.json').version
1313
};
1414

15-
versionCheck(options, function (update, error) {
15+
versionCheck(options, function (error, update) {
1616
if (error) {
1717
console.error(error);
1818
process.exit(-1);

examples/tags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const options = {
1313
fetchTags: true
1414
};
1515

16-
versionCheck(options, function (update, error) {
16+
versionCheck(options, function (error, update) {
1717
if (error) {
1818
console.error(error);
1919
process.exit(-1);

lib/main.coffee

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ check = (options, callback) ->
4040
fetchTags = options.fetchTags || false
4141

4242
# check if required options are defined
43-
callback(null, 'no token specified') if token is undefined
44-
callback(null, 'no repository specified') if repo is undefined
45-
callback(null, 'no owner specified') if owner is undefined
46-
callback(null, 'no current version given') if currentVersion is undefined
43+
callback('no token specified', null) if token is undefined
44+
callback('no repository specified', null) if repo is undefined
45+
callback('no owner specified', null) if owner is undefined
46+
callback('no current version given', null) if currentVersion is undefined
4747

4848
# build the query
4949
query = if fetchTags then query.tags repo, owner else query.releases repo, owner
5050

5151
# do the api call
5252
graphql (token: token, query: query), (err, res) ->
5353
if err
54-
callback null, err
54+
callback err, null
5555
else
5656
# Retrieve newer version name
5757
newer =
@@ -62,7 +62,7 @@ check = (options, callback) ->
6262

6363
# Compare versions
6464
if semver.gt (if fetchTags then newer.name else newer.tag.name), currentVersion
65-
callback newer, null
65+
callback null, newer
6666
else
6767
callback null, null
6868

0 commit comments

Comments
 (0)