generateFakeRepoUrl will return a fake url for repo url field.
(endpoint string, repoId int)
| 129 | |
| 130 | // generateFakeRepoUrl will return a fake url for repo url field. |
| 131 | func generateFakeRepoUrl(endpoint string, repoId int) (string, error) { |
| 132 | if endpoint == "" { |
| 133 | return "", errors.Default.New("empty endpoint") |
| 134 | } |
| 135 | endpointURL, err := url.Parse(endpoint) |
| 136 | if err != nil { |
| 137 | return "", err |
| 138 | } |
| 139 | return fmt.Sprintf("fake://%s/repos/%d", endpointURL.Host, repoId), nil |
| 140 | } |
| 141 | |
| 142 | // covertError will identify some known errors and transform it to a simple form. |
| 143 | func covertError(err errors.Error) errors.Error { |