Close callback contexts when callbacks panic
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user