Skip to content

Commit 981ddb1

Browse files
committed
improve the step output handling
1 parent 9140b90 commit 981ddb1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/output.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const colors = require('chalk')
22
const figures = require('figures')
33
const { maskSensitiveData } = require('invisi-data')
4+
const Step = require('./step')
45

56
const styles = {
67
error: colors.bgRed.white.bold,
@@ -115,7 +116,7 @@ module.exports = {
115116
}
116117
}
117118

118-
try {
119+
if (step instanceof Step) {
119120
let stepLine = step.toCliStyled()
120121
if (step.metaStep && outputLevel >= 1) {
121122
// this.stepShift += 2;
@@ -127,9 +128,11 @@ module.exports = {
127128

128129
const _stepLine = isMaskedData() ? maskSensitiveData(stepLine) : stepLine
129130
print(' '.repeat(this.stepShift), truncate(_stepLine, this.spaceShift))
130-
} catch (e) {
131+
} else if (typeof step === 'string') {
131132
// sometimes the step is just the string, so we basically print it out
132133
print(step)
134+
} else {
135+
console.log(`Something went wrong with ${step}`)
133136
}
134137
},
135138

0 commit comments

Comments
 (0)