Skip to content

Commit e786ece

Browse files
committed
Catch errors when resolving config and creating context
1 parent ecdfc1a commit e786ece

File tree

1 file changed

+15
-10
lines changed
  • packages/tailwindcss-language-server/src

1 file changed

+15
-10
lines changed

packages/tailwindcss-language-server/src/server.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -857,17 +857,22 @@ async function createProjectService(
857857
throw new SilentError(`Failed to load config file: ${state.configPath}`)
858858
}
859859

860-
state.config = resolveConfig.module(originalConfig)
861-
state.separator = state.config.separator
862-
863-
if (state.jit) {
864-
state.jitContext = state.modules.jit.createContext.module(state)
865-
state.jitContext.tailwindConfig.separator = state.config.separator
866-
if (state.jitContext.getClassList) {
867-
state.classList = state.jitContext.getClassList().map((className) => {
868-
return [className, { color: getColor(state, className) }]
869-
})
860+
try {
861+
state.config = resolveConfig.module(originalConfig)
862+
state.separator = state.config.separator
863+
864+
if (state.jit) {
865+
state.jitContext = state.modules.jit.createContext.module(state)
866+
state.jitContext.tailwindConfig.separator = state.config.separator
867+
if (state.jitContext.getClassList) {
868+
state.classList = state.jitContext.getClassList().map((className) => {
869+
return [className, { color: getColor(state, className) }]
870+
})
871+
}
870872
}
873+
} catch (error) {
874+
hook.unhook()
875+
throw error
871876
}
872877

873878
let postcssResult: Result

0 commit comments

Comments
 (0)