Browse files

Show error with option

  • Loading branch information...
1 parent c356456 commit 7f6f7f0df181c9c43aa307458a28724b34c817b2 @pksunkara committed Apr 22, 2012
Showing with 18 additions and 0 deletions.
  1. +15 −0 README.md
  2. +3 −0 index.js
View
15 README.md
@@ -51,6 +51,21 @@ info: app.js ok
info: app.js not ok
```
+### Show the error
+
+You can give the `show` option to the plugin if you want to print the `err.message` passed to the callback
+
+```js
+app.use('flatiron-cli-ok', { show: true });
+```
+
+So in case of error, the output will end with
+
+```
+error: Bad credentials
+info: app.js not ok
+```
+
### IMPORTANT
__You have to call the callback in the command, if you want this plugin to show the status__
View
3 index.js
@@ -30,6 +30,9 @@ cliOk.attach = function (options) {
start(options || {}, function (err) {
if (cb) return cb(err);
if (err) {
+ if (err.message && options.show) {
+ app.log.error(err.message.red.bold);
+ }
app.log.info(app.name.grey + ' ' + 'not'.red.bold + ' ' + 'ok'.red.bold);
} else {
app.log.info(app.name.grey + ' ' + 'ok'.green.bold);

0 comments on commit 7f6f7f0

Please sign in to comment.