On certain kinds of errors like duplicate key errors, no code is set on the OperationError exception.
Steps to reproduce:
require 'mongo' client = Mongo::Client.new("mongodb://localhost/test") begin client['test'].insert_one(_id: '1') client['test'].insert_one(_id: '1') rescue => e puts "Code: #{e.code.inspect}" end
Expected Result:
Prints "Code 11000"
Actual Result:
Prints "Code nil"
- is duplicated by
-
RUBY-1550 Error::Parser fails to correctly handle writeErrors
- Closed
- is related to
-
RUBY-1331 Errors raised by drivers should include codeName string from server response
- Closed
- related to
-
SERVER-36755 writeErrors codeName is set in sharded cluster topology only
- Backlog