Skip to content

Commit 4fccd3f

Browse files
committed
Add a black background for error messages
1 parent 5c3666e commit 4fccd3f

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

tools/office-cmdlet-updater/controllers/cli.controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { errorColor } = require('../helpers/colors');
2+
13
class CliController {
24
constructor(
35
cliService,
@@ -73,7 +75,7 @@ class CliController {
7375
isNeedEmail
7476
})
7577
.catch((err) => {
76-
console.error(err);
78+
console.error(errorColor(err));
7779

7880
this.powerShellService.dispose();
7981
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const chalk = require('chalk');
2+
3+
const errorColor = chalk.red.bgBlack;
4+
5+
module.exports = {
6+
errorColor
7+
};

tools/office-cmdlet-updater/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"await-of": "^1.1.2",
2828
"awilix": "^3.0.9",
2929
"better-queue": "^3.8.10",
30+
"chalk": "^2.4.2",
3031
"commander": "^2.19.0",
3132
"config": "^2.0.1",
3233
"fs-extra": "^7.0.0",

tools/office-cmdlet-updater/services/power.shell.service.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const Shell = require('node-powershell');
22
const of = require('await-of').default;
33
const commands = require('../constants/commands');
44
const format = require('string-format');
5+
const { errorColor } = require('../helpers/colors');
56

67
class PowerShellService {
78
constructor(config) {
@@ -24,8 +25,6 @@ class PowerShellService {
2425
const [output, err] = await of(this.ps.invoke());
2526

2627
if (err) {
27-
console.error(err);
28-
2928
throw new Error(err);
3029
}
3130

@@ -38,7 +37,7 @@ class PowerShellService {
3837
const [output, err] = await of(this.ps.invoke());
3938

4039
if (err && printError) {
41-
console.error(err);
40+
console.error(errorColor(err));
4241
}
4342

4443
return output;

0 commit comments

Comments
 (0)