Module: Orientdb4r::Binary::OIO

Included in:
BinClient
Defined in:
lib/orientdb4r/bin/io.rb

Instance Method Summary collapse

Instance Method Details

#req_resp(socket, req, resp) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/orientdb4r/bin/io.rb', line 10

def req_resp(socket, req, resp)
  req.write(socket)

  status = BinData::Int8.read(socket).to_i
  if ::Orientdb4r::Binary::Constants::STATUS_ERROR == status
    errors = protocol::Errors.read(socket)
    exceptions = errors[:exceptions]
    Orientdb4r::logger.error "exception(s): #{exceptions}"

    # if exceptions[0] && exceptions[0][:exception_class] == "com.orientechnologies.orient.core.exception.ORecordNotFoundException"
    #   raise RecordNotFound.new(session)
    # else
    #  raise ServerError.new(session, *exceptions)
    # end
    raise ServerError, exceptions[0..-2]
  end

BinData::trace_reading do
  resp.read(socket)
end
  resp
end