Sha256: f0af861ae3de8d9286a3d6db4ab563912bb23ac8c4fbe64ef13b5eeeee389dde

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 Bytes

Contents

#
# This class store the main processing wrapper which talks to the API and handles all the exceptions
#
# This class smells of :reek:InstanceVariableAssumption
class GithubListerCore
    class << self
        #
        # Everything below here is private
        #

        private

        # rubocop:disable Metrics/MethodLength
        def function_wrapper(client, function, *param)
            begin
                results = client.send(function, *param)
            rescue Octokit::Unauthorized
                raise InvalidTokenError.new if client.user_authenticated?

                raise MissingTokenError.new
            rescue Octokit::NotFound
                raise NotFoundError.new
            rescue Octokit::TooManyRequests
                raise TooManyRequests.new
            rescue StandardError
                raise UnknownError.new
            end
            results || []
        end
    end
    # rubocop:enable Metrics/MethodLength
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github-lister-core-0.1.2 lib/github-lister-core/wrapper.rb
github-lister-core-0.1.1 lib/github-lister-core/wrapper.rb
github-lister-core-0.1.0 lib/github-lister-core/wrapper.rb