errors.js 579 B

123456789101112131415161718192021222324252627282930313233343536
  1. const maxRetry = 3
  2. class GitError extends Error {
  3. shouldRetry () {
  4. return false
  5. }
  6. }
  7. class GitConnectionError extends GitError {
  8. constructor () {
  9. super('A git connection error occurred')
  10. }
  11. shouldRetry (number) {
  12. return number < maxRetry
  13. }
  14. }
  15. class GitPathspecError extends GitError {
  16. constructor () {
  17. super('The git reference could not be found')
  18. }
  19. }
  20. class GitUnknownError extends GitError {
  21. constructor () {
  22. super('An unknown git error occurred')
  23. }
  24. }
  25. module.exports = {
  26. GitConnectionError,
  27. GitPathspecError,
  28. GitUnknownError,
  29. }