MCPcopy Create free account
hub / github.com/larksuite/cli / installPluginInstallErrorGuard

Function installPluginInstallErrorGuard

cmd/platform_guards.go:77–90  ·  view source on GitHub ↗

installPluginInstallErrorGuard surfaces a FailClosed plugin install failure as a typed validation error (failed_precondition) before any command runs.

(rootCmd *cobra.Command, installErr error)

Source from the content-addressed store, hash-verified

75// failure as a typed validation error (failed_precondition) before any
76// command runs.
77func installPluginInstallErrorGuard(rootCmd *cobra.Command, installErr error) {
78 makeErr := func() error {
79 var pi *internalplatform.PluginInstallError
80 if errors.As(installErr, &pi) {
81 return errs.NewValidationError(errs.SubtypeFailedPrecondition, "%s", pi.Error()).
82 WithHint("plugin %q failed to install (reason_code %s); fix or remove the plugin before running commands", pi.PluginName, pi.ReasonCode).
83 WithCause(installErr)
84 }
85 return errs.NewValidationError(errs.SubtypeFailedPrecondition, "%s", installErr.Error()).
86 WithHint("a plugin failed to install (reason_code %s); fix or remove the plugin before running commands", internalplatform.ReasonInstallFailed).
87 WithCause(installErr)
88 }
89 installFatalGuard(rootCmd, makeErr)
90}
91
92// installPluginConflictGuard surfaces a Plugin.Restrict() configuration
93// error (single plugin invalid Rule or multiple plugins each contributing

Callers 1

buildInternalFunction · 0.85

Calls 7

ErrorMethod · 0.95
NewValidationErrorFunction · 0.92
installFatalGuardFunction · 0.85
AsMethod · 0.80
WithCauseMethod · 0.45
WithHintMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected