MCPcopy
hub / github.com/desktop/desktop / getDescriptionForError

Function getDescriptionForError

app/src/lib/git/core.ts:447–586  ·  view source on GitHub ↗
(
  error: DugiteError,
  stderr: string
)

Source from the content-addressed store, hash-verified

445}
446
447export function getDescriptionForError(
448 error: DugiteError,
449 stderr: string
450): string | null {
451 if (isAuthFailureError(error)) {
452 const menuHint = __DARWIN__
453 ? 'GitHub Desktop > Settings.'
454 : 'File > Options.'
455 return `Authentication failed. Some common reasons include:
456
457- You are not logged in to your account: see ${menuHint}
458- You may need to log out and log back in to refresh your token.
459- You do not have permission to access this repository.
460- The repository is archived on GitHub. Check the repository settings to confirm you are still permitted to push commits.
461- If you use SSH authentication, check that your key is added to the ssh-agent and associated with your account.
462- If you use SSH authentication, ensure the host key verification passes for your repository hosting service.
463- If you used username / password authentication, you might need to use a Personal Access Token instead of your account password. Check the documentation of your repository hosting service.`
464 }
465
466 switch (error) {
467 case DugiteError.BadConfigValue:
468 const errorInfo = parseBadConfigValueErrorInfo(stderr)
469 if (errorInfo === null) {
470 return 'Unsupported git configuration value.'
471 }
472
473 return `Unsupported value '${errorInfo.value}' for git config key '${errorInfo.key}'`
474 case DugiteError.SSHKeyAuditUnverified:
475 return 'The SSH key is unverified.'
476 case DugiteError.RemoteDisconnection:
477 return 'The remote disconnected. Check your Internet connection and try again.'
478 case DugiteError.HostDown:
479 return 'The host is down. Check your Internet connection and try again.'
480 case DugiteError.RebaseConflicts:
481 return 'We found some conflicts while trying to rebase. Please resolve the conflicts before continuing.'
482 case DugiteError.MergeConflicts:
483 return 'We found some conflicts while trying to merge. Please resolve the conflicts and commit the changes.'
484 case DugiteError.HTTPSRepositoryNotFound:
485 case DugiteError.SSHRepositoryNotFound:
486 return 'The repository does not seem to exist anymore. You may not have access, or it may have been deleted or renamed.'
487 case DugiteError.PushNotFastForward:
488 return 'The repository has been updated since you last pulled. Try pulling before pushing.'
489 case DugiteError.BranchDeletionFailed:
490 return 'Could not delete the branch. It was probably already deleted.'
491 case DugiteError.DefaultBranchDeletionFailed:
492 return `The branch is the repository's default branch and cannot be deleted.`
493 case DugiteError.RevertConflicts:
494 return 'To finish reverting, please merge and commit the changes.'
495 case DugiteError.EmptyRebasePatch:
496 return 'There aren’t any changes left to apply.'
497 case DugiteError.NoMatchingRemoteBranch:
498 return 'There aren’t any remote branches that match the current branch.'
499 case DugiteError.NothingToCommit:
500 return 'There are no changes to commit.'
501 case DugiteError.NoSubmoduleMapping:
502 return 'A submodule was removed from .gitmodules, but the folder still exists in the repository. Delete the folder, commit the change, then try again.'
503 case DugiteError.SubmoduleRepositoryDoesNotExist:
504 return 'A submodule points to a location which does not exist.'

Callers 2

withTrampolineEnvFunction · 0.90
gitFunction · 0.85

Calls 2

assertNeverFunction · 0.90
isAuthFailureErrorFunction · 0.85

Tested by

no test coverage detected