Skip to content

Commit

Permalink
Handle config loading failure in serve.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
0Miles committed Feb 28, 2024
1 parent 7e2391b commit 4478f0b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/language-server/src/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,19 @@ export default function serve() {
}
if (root?.uri) {
const configCWD = fileURLToPath(root.uri.replace('%3A', ':'))
customConfig = exploreConfig(settings.config || 'master.css', {
cwd: configCWD,
found: (basename) => console.log`Loaded **${basename}**`
})
css = new MasterCSS(customConfig)
try {
customConfig = exploreConfig(settings.config || 'master.css', {
cwd: configCWD,
found: (basename) => console.log`Loaded **${basename}**`
})
css = new MasterCSS(customConfig)
}
catch (e) {
console.log('Config loading failed')
console.error(e)
css = new MasterCSS()
console.log('Using default config')
}
}
}

Expand Down

0 comments on commit 4478f0b

Please sign in to comment.