Sha256: adcd932552bd51a5614ed1b589b3d2b92c54ff413df0378b128f46b7f479a9c8

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require 'protobuf/rpc/rpc.pb'

module Protobuf
  module Rpc

    class BadRequestData < PbError
      def initialize(message = 'Unable to parse request')
        super message, 'BAD_REQUEST_DATA'
      end
    end

    class BadRequestProto < PbError
      def initialize(message = 'Request is of wrong type')
        super message, 'BAD_REQUEST_PROTO'
      end
    end

    class ServiceNotFound < PbError
      def initialize(message = 'Service class not found')
        super message, 'SERVICE_NOT_FOUND'
      end
    end

    class MethodNotFound < PbError
      def initialize(message = 'Service method not found')
        super message, 'METHOD_NOT_FOUND'
      end
    end

    class RpcError < PbError
      def initialize(message = 'RPC exception occurred')
        super message, 'RPC_ERROR'
      end
    end

    class RpcFailed < PbError
      def initialize(message = 'RPC failed')
        super message, 'RPC_FAILED'
      end
    end

    class UnauthorizedRequest < PbError
      def initialize(message = 'The request requires user authentication')
        super message, 'UNAUTHORIZED_REQUEST'
      end
    end

    class ForbiddenRequest < PbError
      def initialize(message = 'User authentificated but does not have permissions')
        super message, 'FORBIDDEN_REQUEST'
      end
    end

    class DataNotFound < PbError
      def initialize(message = 'Requested data not found')
        super message, 'DATA_NOT_FOUND'
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
protobuffy-4.0.1 lib/protobuf/rpc/error/server_error.rb
protobuffy-4.0.0 lib/protobuf/rpc/error/server_error.rb