code.gitea.io/gitea@v1.22.3/services/migrations/error.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // Copyright 2018 Jonas Franz. All rights reserved.
     3  // SPDX-License-Identifier: MIT
     4  
     5  package migrations
     6  
     7  import (
     8  	"errors"
     9  
    10  	"github.com/google/go-github/v57/github"
    11  )
    12  
    13  // ErrRepoNotCreated returns the error that repository not created
    14  var ErrRepoNotCreated = errors.New("repository is not created yet")
    15  
    16  // IsRateLimitError returns true if the err is github.RateLimitError
    17  func IsRateLimitError(err error) bool {
    18  	_, ok := err.(*github.RateLimitError)
    19  	return ok
    20  }
    21  
    22  // IsTwoFactorAuthError returns true if the err is github.TwoFactorAuthError
    23  func IsTwoFactorAuthError(err error) bool {
    24  	_, ok := err.(*github.TwoFactorAuthError)
    25  	return ok
    26  }