MCPcopy
hub / github.com/larksuite/cli / readFailurePolicy

Function readFailurePolicy

internal/platform/host.go:244–249  ·  view source on GitHub ↗

readFailurePolicy reads Capabilities and returns the policy, falling back to FailClosed if Capabilities() panics. Defensive default: we assume the worst-case (safety-sensitive) when we cannot read the declaration. **Implementation note**: FailClosed must be the value set BEFORE the panic-prone call

(p platform.Plugin)

Source from the content-addressed store, hash-verified

242// flip the safe-default to FailOpen on panic -- the opposite of what
243// the comment claims.
244func readFailurePolicy(p platform.Plugin) (policy platform.FailurePolicy) {
245 policy = platform.FailClosed
246 defer func() { _ = recover() }()
247 policy = p.Capabilities().FailurePolicy
248 return
249}
250
251// safeCallName recovers from a panic in Plugin.Name() and surfaces it
252// as a typed PluginInstallError. Without recovery, a buggy plugin could

Callers 1

InstallAllFunction · 0.85

Calls 1

CapabilitiesMethod · 0.65

Tested by

no test coverage detected