MCPcopy Create free account
hub / github.com/bytebase/bytebase / formatChangeStepErrorWithHint

Function formatChangeStepErrorWithHint

backend/api/mcp/tool_change.go:592–612  ·  view source on GitHub ↗

formatChangeStepErrorWithHint is like formatChangeStepError but replaces the default suggestion with hint when non-empty, keeping the JSON shape intact.

(err error, defaultCode, permission string, partialRefs map[string]string, hint string)

Source from the content-addressed store, hash-verified

590// formatChangeStepErrorWithHint is like formatChangeStepError but replaces the
591// default suggestion with hint when non-empty, keeping the JSON shape intact.
592func formatChangeStepErrorWithHint(err error, defaultCode, permission string, partialRefs map[string]string, hint string) *mcp.CallToolResult {
593 var te *toolError
594 if errors.As(err, &te) && te.Code == "PERMISSION_DENIED" {
595 return formatChangeError(&changeError{
596 Code: "PERMISSION_DENIED",
597 Message: te.Message,
598 Suggestion: fmt.Sprintf("ask your workspace admin to grant you the %s permission", permission),
599 PartialRefs: partialRefs,
600 })
601 }
602 suggestion := "check the error and retry"
603 if hint != "" {
604 suggestion = hint
605 }
606 return formatChangeError(&changeError{
607 Code: defaultCode,
608 Message: err.Error(),
609 Suggestion: suggestion,
610 PartialRefs: partialRefs,
611 })
612}

Callers 2

handleChangeMethod · 0.85
formatChangeStepErrorFunction · 0.85

Calls 2

formatChangeErrorFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected