func IsTransientError()

in tools/mc2bq/pkg/gapiutil/gapiutil.go [57:77]


func IsTransientError(err error) bool {
	if err == nil {
		return false
	}
	var gapiError *googleapi.Error
	if !errors.As(err, &gapiError) {
		return false
	}

	// See https://cloud.google.com/storage/docs/xml-api/reference-status
	switch gapiError.Code {
	case http.StatusTooManyRequests,
		http.StatusRequestTimeout,
		http.StatusInternalServerError,
		http.StatusServiceUnavailable,
		http.StatusGatewayTimeout:
		return true
	}

	return false
}