Sha256: cc56a63d585ec54ce72bc07e6fcdcc8fd91fa833f4200c1e72fc9f83610e714b

Contents?: true

Size: 610 Bytes

Versions: 40

Compression:

Stored size: 610 Bytes

Contents

require "json"
module Gitea
  module Api 
    class ServerError < Common::Exception 
      attr_reader :http_code, :error_code, :message 

      def initialize(response)
        @http_code = response.code 
        @attrs = JSON.parse(response.body) rescue {}
      end

      def to_s
        @attrs.delete('documentation_url')
        @attrs.merge({'HTTPCode' => @http_code}).map do |k, v|
          [k, v].join(": ")
        end.join(", ")
      end
    end

    class CallBackError < ServerError 
    end # CallBackError

    class ClientError < Common::Exception
    end # ClientError
  end # Api
end # Git

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
gitea-client-0.11.0 lib/gitea/api/exception.rb
gitea-client-0.10.6 lib/gitea/api/exception.rb
gitea-client-0.10.5 lib/gitea/api/exception.rb
gitea-client-0.10.4 lib/gitea/api/exception.rb
gitea-client-0.10.3 lib/gitea/api/exception.rb
gitea-client-0.10.2 lib/gitea/api/exception.rb
gitea-client-0.10.0 lib/gitea/api/exception.rb
gitea-client-0.9.4 lib/gitea/api/exception.rb
gitea-client-0.9.3 lib/gitea/api/exception.rb
gitea-client-0.9.2 lib/gitea/api/exception.rb
gitea-client-0.9.1 lib/gitea/api/exception.rb
gitea-client-0.9.0 lib/gitea/api/exception.rb
gitea-client-0.8.2 lib/gitea/api/exception.rb
gitea-client-0.8.0 lib/gitea/api/exception.rb
gitea-client-0.8.1 lib/gitea/api/exception.rb
gitea-client-0.7.1 lib/gitea/api/exception.rb
gitea-client-0.7.0 lib/gitea/api/exception.rb
gitea-client-0.6.2 lib/gitea/api/exception.rb
gitea-client-0.6.1 lib/gitea/api/exception.rb
gitea-client-0.6.0 lib/gitea/api/exception.rb