Skip to content

Commit 108fe6d

Browse files
author
cfernandes
committed
Use non-zero exit codes when something goes wrong
1 parent 1b12d60 commit 108fe6d

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ encoded.
179179
synchronization of these certificates will be skipped and a warning will
180180
be printed.
181181

182+
### Release process
183+
The release process uses the `release-me` NPM module
184+
182185
### Notes
183186
To my understanding, the dependency graph can be visualized like this:
184187

bin/operations/backup.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ module.exports = async function backup(filename, url, username, password) {
4747
snis
4848
};
4949

50-
// TODO: implement the backup process for SNIs
51-
5250
fs.writeFileSync(adjustedFileName, JSON.stringify(results, null, 4));
53-
console.log(`Backup data has been written to ${adjustedFileName}`.green)
51+
console.log(`Backup data has been written to ${adjustedFileName}`.green);
52+
console.log(' '.reset);
5453
} catch (e) {
55-
console.log(e.message.red)
56-
} finally {
54+
console.log(e.message.red);
5755
console.log(' '.reset);
56+
// non-zero exit code for Unix
57+
process.exit(1);
5858
}
5959
};

bin/operations/synchronization.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ module.exports = async function synchronization(filename, url, username, passwor
209209

210210
console.log('Consumer and Credentials updates complete'.green);
211211
console.log('Synchronization process complete'.green.bold);
212+
console.log(' '.reset);
212213
} catch (e) {
213214
console.log(e);
214215
console.log(e.message.red);
215-
} finally {
216216
console.log(' '.reset);
217+
// non-zero exit code for Unix
218+
process.exit(1);
217219
}
218220
};

bin/operations/teardown.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ module.exports = async function teardown(url, username, password) {
3333
const certificateIds = certificates.map(certificate => certificate.id);
3434
certificateIds.map(async id => await kong.certificates.removeCertificate(id).catch(err => console.log(err.message.grey)));
3535
console.log('Certificate deletion complete'.red.reset);
36+
console.log('Teardown process complete'.reset);
3637
} catch (e) {
37-
console.log(e.message.red)
38-
} finally {
38+
console.log(e.message.red);
3939
console.log('Teardown process complete'.reset);
40+
// non-zero exit code for Unix
41+
process.exit(1);
4042
}
4143
};

0 commit comments

Comments
 (0)