Skip to content

Commit 5fef42c

Browse files
committed
feat: better validation error message
1 parent 8a3ac7e commit 5fef42c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
const joi = require('joi')
2+
const { error } = require('./logger')
23

34
// proxy to joi for option validation
45
exports.createSchema = fn => fn(joi)
56

67
exports.validate = (obj, schema, options = {}) => {
78
joi.validate(obj, schema, options, err => {
89
if (err) {
9-
throw err
10+
error(`vue-cli options validation failed:\n` + err.message)
11+
process.exit(1)
1012
}
1113
})
1214
}

0 commit comments

Comments
 (0)