func isHTTP2Error()

in metrics/utils.go [115:137]


func isHTTP2Error(err error) (string, bool) {
	if err == nil {
		return "", false
	}

	if connErr, ok := err.(http2.ConnectionError); ok || errors.As(err, &connErr) {
		return (http2.ErrCode(connErr)).String(), true
	}

	if streamErr, ok := err.(http2.StreamError); ok || errors.As(err, &streamErr) {
		return streamErr.Code.String(), true
	}

	if connErr, ok := err.(http2.GoAwayError); ok || errors.As(err, &connErr) {
		return fmt.Sprintf("http2: server sent GOAWAY and closed the connection; ErrCode=%v, debug=%s",
			connErr.ErrCode, connErr.DebugData), true
	}

	if strings.Contains(err.Error(), errHTTP2ClientConnectionLost.Error()) {
		return errHTTP2ClientConnectionLost.Error(), true
	}
	return "", false
}