Sha256: 29b4a584f5d9388e2c8fdf5122f00128ac61dfa6061f77b54a08446202e1631c

Contents?: true

Size: 698 Bytes

Versions: 127

Compression:

Stored size: 698 Bytes

Contents

require 'protobuf/rpc/rpc.pb'

module Protobuf
  module Rpc
    ClientError = Struct.new("ClientError", :code, :message)

    # Base PbError class for client and server errors
    class PbError < StandardError
      attr_reader :error_type

      def initialize message='An unknown RpcError occurred', error_type='RPC_ERROR'
        @error_type = error_type.is_a?(String) ? ::Protobuf::Socketrpc::ErrorReason.const_get(error_type) : error_type
        super message
      end

      def to_response response
        response.error = message
        response.error_reason = @error_type
      end
    end
  end
end

require 'protobuf/rpc/error/server_error'
require 'protobuf/rpc/error/client_error'

Version data entries

127 entries across 127 versions & 1 rubygems

Version Path
protobuf-2.8.13 lib/protobuf/rpc/error.rb
protobuf-2.8.12 lib/protobuf/rpc/error.rb
protobuf-2.8.11 lib/protobuf/rpc/error.rb
protobuf-2.8.10 lib/protobuf/rpc/error.rb
protobuf-2.8.9 lib/protobuf/rpc/error.rb
protobuf-2.8.8 lib/protobuf/rpc/error.rb
protobuf-2.8.7 lib/protobuf/rpc/error.rb
protobuf-2.8.6 lib/protobuf/rpc/error.rb
protobuf-2.7.12 lib/protobuf/rpc/error.rb
protobuf-2.8.5 lib/protobuf/rpc/error.rb
protobuf-2.8.4 lib/protobuf/rpc/error.rb
protobuf-2.8.3 lib/protobuf/rpc/error.rb
protobuf-2.8.2 lib/protobuf/rpc/error.rb
protobuf-2.8.1 lib/protobuf/rpc/error.rb
protobuf-2.8.0 lib/protobuf/rpc/error.rb
protobuf-2.8.0.beta9-java lib/protobuf/rpc/error.rb
protobuf-2.8.0.beta9 lib/protobuf/rpc/error.rb
protobuf-2.8.0.beta8-java lib/protobuf/rpc/error.rb
protobuf-2.8.0.beta8 lib/protobuf/rpc/error.rb
protobuf-2.8.0.beta6-java lib/protobuf/rpc/error.rb