Skip to content

Commit 4fc58f1

Browse files
committed
Rename to parsing failed as it's an error string
1 parent ec51666 commit 4fc58f1

File tree

13 files changed

+19
-24
lines changed

13 files changed

+19
-24
lines changed

internal/command/personalaccesstoken/personalaccesstoken_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestExecute(t *testing.T) {
139139
GitlabKeyId: "badresponse",
140140
SshArgs: []string{cmdname, "newtoken", "read_api,read_repository"},
141141
},
142-
expectedError: "Parsing failed",
142+
expectedError: "parsing failed",
143143
},
144144
{
145145
desc: "when API returns an error",

internal/command/twofactorrecover/twofactorrecover_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func TestExecute(t *testing.T) {
8585
desc: "With bad response",
8686
arguments: &commandargs.Shell{GitlabKeyId: "-1"},
8787
answer: "yes\n",
88-
expectedOutput: question + errorHeader + "Parsing failed\n",
88+
expectedOutput: question + errorHeader + "parsing failed\n",
8989
},
9090
{
9191
desc: "With API returns an error",

internal/command/twofactorverify/twofactorverify_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestExecute(t *testing.T) {
126126
{
127127
desc: "With bad response",
128128
arguments: &commandargs.Shell{GitlabKeyId: "-1"},
129-
expectedOutput: errorHeader + "Parsing failed\n",
129+
expectedOutput: errorHeader + "parsing failed\n",
130130
},
131131
{
132132
desc: "With API returns an error",

internal/gitlabnet/accessverifier/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func TestErrorResponses(t *testing.T) {
174174
{
175175
desc: "A response with bad JSON",
176176
fakeID: "3",
177-
expectedError: "Parsing failed",
177+
expectedError: "parsing failed",
178178
},
179179
{
180180
desc: "An error response without message",

internal/gitlabnet/authorizedcerts/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestGetByKeyErrorResponses(t *testing.T) {
7070
{
7171
desc: "A response with bad JSON",
7272
key: "broken-json",
73-
expectedError: "Parsing failed",
73+
expectedError: "parsing failed",
7474
},
7575
{
7676
desc: "A forbidden (403) response without message",

internal/gitlabnet/authorizedkeys/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestGetByKeyErrorResponses(t *testing.T) {
7070
{
7171
desc: "A response with bad JSON",
7272
key: "broken-json",
73-
expectedError: "Parsing failed",
73+
expectedError: "parsing failed",
7474
},
7575
{
7676
desc: "A forbidden (403) response without message",

internal/gitlabnet/client.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import (
1111
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/config"
1212
)
1313

14-
var (
15-
ParsingError = fmt.Errorf("Parsing failed")
16-
)
17-
1814
func GetClient(config *config.Config) (*client.GitlabNetClient, error) {
1915
httpClient, err := config.HTTPClient()
2016
if err != nil {
@@ -30,7 +26,7 @@ func GetClient(config *config.Config) (*client.GitlabNetClient, error) {
3026

3127
func ParseJSON(hr *http.Response, response interface{}) error {
3228
if err := json.NewDecoder(hr.Body).Decode(response); err != nil {
33-
return ParsingError
29+
return fmt.Errorf("parsing failed")
3430
}
3531

3632
return nil

internal/gitlabnet/discover/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func TestErrorResponses(t *testing.T) {
120120
{
121121
desc: "A response with bad JSON",
122122
fakeUsername: "broken_json",
123-
expectedError: "Parsing failed",
123+
expectedError: "parsing failed",
124124
},
125125
{
126126
desc: "An error response without message",

internal/gitlabnet/lfsauthenticate/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestFailedRequests(t *testing.T) {
6464
{
6565
desc: "With bad response",
6666
args: &commandargs.Shell{GitlabKeyId: "-1", CommandType: commandargs.LfsAuthenticate, SshArgs: []string{"git-lfs-authenticate", repo, "download"}},
67-
expectedOutput: "Parsing failed",
67+
expectedOutput: "parsing failed",
6868
},
6969
{
7070
desc: "With API returns an error",

internal/gitlabnet/personalaccesstoken/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func TestErrorResponses(t *testing.T) {
140140
{
141141
desc: "A response with bad JSON",
142142
fakeID: "3",
143-
expectedError: "Parsing failed",
143+
expectedError: "parsing failed",
144144
},
145145
{
146146
desc: "An error response without message",

0 commit comments

Comments
 (0)