Sha256: 914be960f974041c4076526ba61a7a34deb5b935cfa2706e91b25055257f07c1

Contents?: true

Size: 1.96 KB

Versions: 164

Compression:

Stored size: 1.96 KB

Contents

module Spaceship
  # Base class for errors that want to present their message as
  # preferred error info for fastlane error handling. See:
  # fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb
  class BasicPreferredInfoError < StandardError
    TITLE = 'The request could not be completed because:'.freeze

    def preferred_error_info
      message ? [TITLE, message] : nil
    end
  end

  # Invalid user credentials were provided
  class InvalidUserCredentialsError < BasicPreferredInfoError; end

  # Raised when no user credentials were passed at all
  class NoUserCredentialsError < BasicPreferredInfoError; end

  class ProgramLicenseAgreementUpdated < BasicPreferredInfoError
    def show_github_issues
      false
    end
  end

  # User doesn't have enough permission for given action
  class InsufficientPermissions < BasicPreferredInfoError
    TITLE = 'Insufficient permissions for your Apple ID:'.freeze

    def preferred_error_info
      message ? [TITLE, message] : nil
    end

    # We don't want to show similar GitHub issues, as the error message
    # should be pretty clear
    def show_github_issues
      false
    end
  end

  class UnexpectedResponse < StandardError
    attr_reader :error_info

    def initialize(error_info = nil)
      super(error_info)
      @error_info = error_info
    end

    def preferred_error_info
      return nil unless @error_info.kind_of?(Hash) && @error_info['resultString']

      [
        "Apple provided the following error info:",
        @error_info['resultString'],
        @error_info['userString']
      ].compact.uniq # sometimes 'resultString' and 'userString' are the same value
    end
  end

  # Raised when 302 is received from portal request
  class AppleTimeoutError < BasicPreferredInfoError; end

  # Raised when 401 is received from portal request
  class UnauthorizedAccessError < BasicPreferredInfoError; end

  # Raised when 500 is received from iTunes Connect
  class InternalServerError < BasicPreferredInfoError; end
end

Version data entries

164 entries across 164 versions & 1 rubygems

Version Path
fastlane-2.96.0.beta.20180521050117 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180520050019 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180519050103 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180518050116 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180517050058 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180516050022 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180515050025 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180514050029 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180513050015 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180512050121 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180511050050 spaceship/lib/spaceship/errors.rb
fastlane-2.96.0.beta.20180510050112 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0.beta.20180509050014 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0.beta.20180508050130 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0.beta.20180507050125 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0.beta.20180506050030 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0.beta.20180505050019 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0.beta.20180504050050 spaceship/lib/spaceship/errors.rb
fastlane-2.95.0.beta.20180503050136 spaceship/lib/spaceship/errors.rb