Skip to content

Commit

Permalink
refactor: log error when theme cannot be resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Oct 29, 2018
1 parent 26ab8fc commit 432e662
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/@vuepress/core/lib/prepare/loadTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ module.exports = async function loadTheme (ctx) {
themePath = localThemePath
logger.tip(`\nApply theme located at ${chalk.gray(themePath)}...`)
} else if (isString(theme)) {
const { entry: modulePath, name, shortcut } = themeResolver.resolve(theme, sourceDir)

const resolved = themeResolver.resolve(theme, sourceDir)
const { entry: modulePath, name, shortcut } = resolved
if (modulePath === null) {
throw new Error(`Cannot resolve theme ${theme}.`)
}
if (modulePath.endsWith('.js') || modulePath.endsWith('.vue')) {
themePath = path.parse(modulePath).dir
} else {
Expand Down

0 comments on commit 432e662

Please sign in to comment.