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

Function categorizeByCode

cmd/gosqlx/internal/output/json.go:440–454  ·  view source on GitHub ↗

categorizeByCode categorizes errors by error code if available

(code, errMsg string)

Source from the content-addressed store, hash-verified

438
439// categorizeByCode categorizes errors by error code if available
440func categorizeByCode(code, errMsg string) string {
441 if code != "" {
442 switch {
443 case strings.HasPrefix(code, "E1"):
444 return "tokenization"
445 case strings.HasPrefix(code, "E2"):
446 return "parsing"
447 case strings.HasPrefix(code, "E3"):
448 return "semantic"
449 case strings.HasPrefix(code, "E4"):
450 return "unsupported"
451 }
452 }
453 return categorizeError(errMsg)
454}
455
456// categorizeError categorizes error messages by type
457func categorizeError(errorMsg string) string {

Callers 2

FormatValidationJSONFunction · 0.85
FormatParseErrorJSONFunction · 0.85

Calls 1

categorizeErrorFunction · 0.85

Tested by

no test coverage detected