MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / CleanInitError

Function CleanInitError

cli/internal/platform/inject.go:554–560  ·  view source on GitHub ↗

CleanInitError turns the gRPC-wrapped plugin-init error from the platform destination into a human-readable message: it unwraps the gRPC status (drops the "rpc error: code = ... desc =" prefix) and strips the plugin-sdk wrapper prefixes, leaving the destination's own message (e.g. the platform's 422

(err error)

Source from the content-addressed store, hash-verified

552// Scope this to the platform destination (see IsInjectedDestination) — the
553// stripped prefixes are specific to that plugin's init path.
554func CleanInitError(err error) string {
555 msg := status.Convert(err).Message()
556 for _, prefix := range []string{"failed to init plugin: ", "failed to initialize client: "} {
557 msg = strings.TrimPrefix(msg, prefix)
558 }
559 return msg
560}

Callers 1

TestCleanInitErrorFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCleanInitErrorFunction · 0.68