Add WriteConcernError and DuplicateKey to error

pull/29/head
Thijs Cadier 7 years ago
parent c4c22e82f4
commit 2a42c5da7b

@ -249,4 +249,6 @@ pub mod bindings {
pub const MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND: ::libc::c_uint = 59; pub const MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND: ::libc::c_uint = 59;
pub const MONGOC_ERROR_QUERY_NOT_TAILABLE: ::libc::c_uint = 13051; pub const MONGOC_ERROR_QUERY_NOT_TAILABLE: ::libc::c_uint = 13051;
pub const MONGOC_ERROR_PROTOCOL_ERROR: ::libc::c_uint = 17; pub const MONGOC_ERROR_PROTOCOL_ERROR: ::libc::c_uint = 17;
pub const MONGOC_ERROR_WRITE_CONCERN_ERROR: ::libc::c_uint = 64;
pub const MONGOC_ERROR_DUPLICATE_KEY: ::libc::c_uint = 11000;
} }

@ -146,6 +146,8 @@ pub enum MongoErrorCode {
ScramProtocolError, ScramProtocolError,
QueryCommandNotFound, QueryCommandNotFound,
QueryNotTailable, QueryNotTailable,
WriteConcernError,
DuplicateKey,
Unknown Unknown
} }
@ -222,6 +224,8 @@ impl BsoncError {
bindings::MONGOC_ERROR_SCRAM_PROTOCOL_ERROR => MongoErrorCode::ScramProtocolError, bindings::MONGOC_ERROR_SCRAM_PROTOCOL_ERROR => MongoErrorCode::ScramProtocolError,
bindings::MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND => MongoErrorCode::QueryCommandNotFound, bindings::MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND => MongoErrorCode::QueryCommandNotFound,
bindings::MONGOC_ERROR_QUERY_NOT_TAILABLE => MongoErrorCode::QueryNotTailable, bindings::MONGOC_ERROR_QUERY_NOT_TAILABLE => MongoErrorCode::QueryNotTailable,
bindings::MONGOC_ERROR_WRITE_CONCERN_ERROR => MongoErrorCode::WriteConcernError,
bindings::MONGOC_ERROR_DUPLICATE_KEY => MongoErrorCode::DuplicateKey,
_ => MongoErrorCode::Unknown _ => MongoErrorCode::Unknown
} }
} }

Loading…
Cancel
Save