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

Function convertErrorToAdvice

backend/component/sheet/sheet.go:90–111  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

88}
89
90func convertErrorToAdvice(err error) []*storepb.Advice {
91 if syntaxErr, ok := err.(*base.SyntaxError); ok {
92 return []*storepb.Advice{
93 {
94 Status: storepb.Advice_ERROR,
95 Code: StatementSyntaxErrorCode,
96 Title: SyntaxErrorTitle,
97 Content: syntaxErr.Message,
98 StartPosition: syntaxErr.Position,
99 },
100 }
101 }
102 return []*storepb.Advice{
103 {
104 Status: storepb.Advice_ERROR,
105 Code: InternalErrorCode,
106 Title: SyntaxErrorTitle,
107 Content: err.Error(),
108 StartPosition: nil,
109 },
110 }
111}

Callers 1

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected