Skip to content

Commit 8e845ff

Browse files
authored
Merge pull request #560 from desktop/parse-http-auth-errors
Parse auth errors for HTTP repos
2 parents 6915785 + 29b23b4 commit 8e845ff

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const GitErrorRegexes: { [regexp: string]: GitError } = {
6969
GitError.BadConfigValue,
7070
'ERROR: ([\\s\\S]+?)\\n+\\[EPOLICYKEYAGE\\]\\n+fatal: Could not read from remote repository.':
7171
GitError.SSHKeyAuditUnverified,
72-
"fatal: Authentication failed for 'https://":
72+
"fatal: Authentication failed for 'https?://":
7373
GitError.HTTPSAuthenticationFailed,
7474
'fatal: Authentication failed': GitError.SSHAuthenticationFailed,
7575
'fatal: Could not read from remote repository.': GitError.SSHPermissionDenied,

test/fast/git-process-test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,21 @@ describe('git-process', () => {
287287
expect((error as any).code).toBe(RepositoryDoesNotExistErrorCode)
288288
})
289289

290-
it('can parse errors', () => {
290+
it('can parse HTTPS auth errors', () => {
291+
const error = GitProcess.parseError(
292+
"fatal: Authentication failed for 'https://www.github.com/shiftkey/desktop.git/'"
293+
)
294+
expect(error).toBe(GitError.HTTPSAuthenticationFailed)
295+
})
296+
297+
it('can parse HTTP auth errors', () => {
298+
const error = GitProcess.parseError(
299+
"fatal: Authentication failed for 'http://localhost:3000'"
300+
)
301+
expect(error).toBe(GitError.HTTPSAuthenticationFailed)
302+
})
303+
304+
it('can parse SSH auth errors', () => {
291305
const error = GitProcess.parseError('fatal: Authentication failed')
292306
expect(error).toBe(GitError.SSHAuthenticationFailed)
293307
})

0 commit comments

Comments
 (0)