GetCode returns the error code from an error, or empty string if not a structured error. Extracts the ErrorCode from a *Error. Returns empty string for non-Error types. Parameters: - err: The error to extract code from Returns the ErrorCode if err is a *Error, empty string otherwise. Example:
(err error)
| 496 | // log.Printf("SQL error [%s]: %v", code, err) |
| 497 | // } |
| 498 | func GetCode(err error) ErrorCode { |
| 499 | if e, ok := err.(*Error); ok { |
| 500 | return e.Code |
| 501 | } |
| 502 | return "" |
| 503 | } |
no outgoing calls