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

Function convertOmniError

backend/plugin/parser/plsql/omni.go:153–173  ·  view source on GitHub ↗
(err error, stmt base.Statement)

Source from the content-addressed store, hash-verified

151}
152
153func convertOmniError(err error, stmt base.Statement) error {
154 var parseErr *oracleparser.ParseError
155 if !errors.As(err, &parseErr) {
156 return err
157 }
158
159 pos := ByteOffsetToRunePosition(stmt.Text, parseErr.Position)
160 if stmt.Start != nil {
161 if pos.Line == 1 {
162 pos.Column += stmt.Start.Column - 1
163 }
164 pos.Line += stmt.Start.Line - 1
165 }
166
167 msg := fmt.Sprintf("Syntax error at line %d:%d: %s", pos.Line, pos.Column, parseErr.Message)
168 return &base.SyntaxError{
169 Position: pos,
170 Message: msg,
171 RawMessage: parseErr.Message,
172 }
173}

Callers 3

validateQueryFunction · 0.70
parsePLSQLStatementFunction · 0.70
parsePLSQLStatementsFunction · 0.70

Calls 1

ByteOffsetToRunePositionFunction · 0.70

Tested by

no test coverage detected