Sha256: 5fab91a026bac0d5364a8fecb858677917fb290db123b6e3d26fc072030139d3

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

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::SAMLProtected
                raise SAMLProtected.new
            rescue Octokit::NotFound
                raise NotFoundError.new
            rescue Octokit::TooManyRequests
                raise TooManyRequests.new
            rescue StandardError => exception
                raise UnknownError.new(exception.to_s)
            end
            results || []
        end
        # rubocop:enable Metrics/MethodLength
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github-lister-core-0.1.8 lib/github-lister-core/wrapper.rb
github-lister-core-0.1.6 lib/github-lister-core/wrapper.rb
github-lister-core-0.1.4 lib/github-lister-core/wrapper.rb