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-1.4.6 lib/gitea/api/exception.rb
gitea-client-1.4.5 lib/gitea/api/exception.rb
gitea-client-1.4.4 lib/gitea/api/exception.rb
gitea-client-1.4.3 lib/gitea/api/exception.rb
gitea-client-1.4.2 lib/gitea/api/exception.rb
gitea-client-1.4.1 lib/gitea/api/exception.rb
gitea-client-1.4.0 lib/gitea/api/exception.rb
gitea-client-1.3.3 lib/gitea/api/exception.rb
gitea-client-1.3.2 lib/gitea/api/exception.rb
gitea-client-1.3.0 lib/gitea/api/exception.rb
gitea-client-1.3.1 lib/gitea/api/exception.rb
gitea-client-0.11.6 lib/gitea/api/exception.rb
gitea-client-0.11.5 lib/gitea/api/exception.rb
gitea-client-1.2.2 lib/gitea/api/exception.rb
gitea-client-0.11.4 lib/gitea/api/exception.rb
gitea-client-1.2.1 lib/gitea/api/exception.rb
gitea-client-1.2.0 lib/gitea/api/exception.rb
gitea-client-1.1.0 lib/gitea/api/exception.rb
gitea-client-1.0.0 lib/gitea/api/exception.rb
gitea-client-0.11.1 lib/gitea/api/exception.rb