Close callback contexts when callbacks panic

This commit is contained in:
2026-10-25 21:25:57 +00:00
parent ea27f17f5c
commit 08a8c25542
4 changed files with 90 additions and 6 deletions

View File

@@ -287,8 +287,11 @@ func runResolution[T any](configuration *T, resolver func(*T, *Resolution) error
records: make(map[string]*resolutionRecord),
}
context := &Resolution{state: state}
err := resolver(configuration, context)
state.active = false
var err error
func() {
defer func() { state.active = false }()
err = resolver(configuration, context)
}()
if err != nil && !hasErrors(state.diagnostics) {
state.addDiagnostic(CodeResolveHookFailed, Path{}, "application resolution failed")
}