Skip to content

Commit

Permalink
feat: better validation error message
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 25, 2018
1 parent 8a3ac7e commit 5fef42c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/@vue/cli-shared-utils/validate.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const joi = require('joi')
const { error } = require('./logger')

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

exports.validate = (obj, schema, options = {}) => {
joi.validate(obj, schema, options, err => {
if (err) {
throw err
error(`vue-cli options validation failed:\n` + err.message)
process.exit(1)
}
})
}

0 comments on commit 5fef42c

Please sign in to comment.