MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / ExtractLocation

Function ExtractLocation

pkg/errors/formatter.go:342–347  ·  view source on GitHub ↗

ExtractLocation extracts the line/column location from a GoSQLX *Error. This is the preferred way to obtain location data for IDE integrations such as LSP diagnostics, since it handles the type assertion safely. Returns the Location and true when err is a *Error; returns a zero Location and false f

(err error)

Source from the content-addressed store, hash-verified

340// Returns the Location and true when err is a *Error; returns a zero Location
341// and false for all other error types.
342func ExtractLocation(err error) (models.Location, bool) {
343 if structErr, ok := err.(*Error); ok {
344 return structErr.Location, true
345 }
346 return models.Location{}, false
347}
348
349// ExtractErrorCode extracts the ErrorCode from a GoSQLX *Error.
350// Unlike GetCode, this function returns a boolean indicating whether the extraction

Callers 1

TestExtractLocationFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestExtractLocationFunction · 0.68