# -*- mode: python -*- error_code("OK", 0) error_code("InternalError", 1) error_code("BadValue", 2) error_code("OBSOLETE_DuplicateKey", 3) error_code("NoSuchKey", 4) error_code("GraphContainsCycle", 5) error_code("HostUnreachable", 6) error_code("HostNotFound", 7) error_code("UnknownError", 8) error_code("FailedToParse", 9) error_code("CannotMutateObject", 10) error_code("UserNotFound", 11) error_code("UnsupportedFormat", 12) error_code("Unauthorized", 13) error_code("TypeMismatch", 14) error_code("Overflow", 15) error_code("InvalidLength", 16) error_code("ProtocolError", 17) error_code("AuthenticationFailed", 18) error_code("CannotReuseObject", 19) error_code("IllegalOperation", 20) error_code("EmptyArrayOperation", 21) error_code("InvalidBSON", 22) error_code("AlreadyInitialized", 23) error_code("LockTimeout", 24) error_code("RemoteValidationError", 25) error_code("NamespaceNotFound", 26) error_code("IndexNotFound", 27) error_code("PathNotViable", 28) error_code("NonExistentPath", 29) error_code("InvalidPath", 30) error_code("RoleNotFound", 31) error_code("RolesNotRelated", 32) error_code("PrivilegeNotFound", 33) error_code("CannotBackfillArray", 34) error_code("UserModificationFailed", 35) error_code("RemoteChangeDetected", 36) error_code("FileRenameFailed", 37) error_code("FileNotOpen", 38) error_code("FileStreamFailed", 39) error_code("ConflictingUpdateOperators", 40) error_code("FileAlreadyOpen", 41) error_code("LogWriteFailed", 42) error_code("CursorNotFound", 43) error_code("UserDataInconsistent", 45) error_code("LockBusy", 46) error_code("NoMatchingDocument", 47) error_code("NamespaceExists", 48) error_code("InvalidRoleModification", 49) error_code("ExceededTimeLimit", 50) error_code("ManualInterventionRequired", 51) error_code("DollarPrefixedFieldName", 52) error_code("InvalidIdField", 53) error_code("NotSingleValueField", 54) error_code("InvalidDBRef", 55) error_code("EmptyFieldName", 56) error_code("DottedFieldName", 57) error_code("RoleModificationFailed", 58) error_code("CommandNotFound", 59) error_code("DatabaseNotFound", 60) error_code("ShardKeyNotFound", 61) error_code("OplogOperationUnsupported", 62) error_code("StaleShardVersion", 63) error_code("WriteConcernFailed", 64) error_code("MultipleErrorsOccurred", 65) error_code("ImmutableField", 66) error_code("CannotCreateIndex", 67 ) error_code("IndexAlreadyExists", 68 ) error_code("AuthSchemaIncompatible", 69) error_code("ShardNotFound", 70) error_code("ReplicaSetNotFound", 71) error_code("InvalidOptions", 72) error_code("InvalidNamespace", 73) error_code("NodeNotFound", 74) error_code("WriteConcernLegacyOK", 75) error_code("NoReplicationEnabled", 76) error_code("OperationIncomplete", 77) error_code("CommandResultSchemaViolation", 78) error_code("UnknownReplWriteConcern", 79) error_code("RoleDataInconsistent", 80) error_code("NoWhereParseContext", 81) error_code("NoProgressMade", 82) error_code("RemoteResultsUnavailable", 83) error_code("DuplicateKeyValue", 84) error_code("IndexOptionsConflict", 85 ) error_code("IndexKeySpecsConflict", 86 ) error_code("CannotSplit", 87) error_code("SplitFailed", 88) error_code("NetworkTimeout", 89) error_code("CallbackCanceled", 90) error_code("ShutdownInProgress", 91) error_code("SecondaryAheadOfPrimary", 92) error_code("InvalidReplicaSetConfig", 93) error_code("NotYetInitialized", 94) error_code("NotSecondary", 95) error_code("OperationFailed", 96) error_code("NoProjectionFound", 97) error_code("DBPathInUse", 98) error_code("WriteConcernNotDefined", 99) error_code("CannotSatisfyWriteConcern", 100) error_code("OutdatedClient", 101) error_code("IncompatibleAuditMetadata", 102) error_code("NewReplicaSetConfigurationIncompatible", 103) error_code("NodeNotElectable", 104) error_code("IncompatibleShardingMetadata", 105) error_code("DistributedClockSkewed", 106) error_code("LockFailed", 107) error_code("InconsistentReplicaSetNames", 108) error_code("ConfigurationInProgress", 109) error_code("CannotInitializeNodeWithData", 110) error_code("NotExactValueField", 111) error_code("WriteConflict", 112) error_code("InitialSyncFailure", 113) error_code("InitialSyncOplogSourceMissing", 114) error_code("CommandNotSupported", 115) error_code("DocTooLargeForCapped", 116) error_code("ConflictingOperationInProgress", 117) error_code("NamespaceNotSharded", 118) error_code("InvalidSyncSource", 119) error_code("OplogStartMissing", 120) error_code("DocumentValidationFailure", 121) # Only for the document validator on collections. error_code("OBSOLETE_ReadAfterOptimeTimeout", 122) error_code("NotAReplicaSet", 123) error_code("IncompatibleElectionProtocol", 124) error_code("CommandFailed", 125) error_code("RPCProtocolNegotiationFailed", 126) error_code("UnrecoverableRollbackError", 127) error_code("LockNotFound", 128) error_code("LockStateChangeFailed", 129) error_code("SymbolNotFound", 130) error_code("RLPInitializationFailed", 131) error_code("ConfigServersInconsistent", 132) error_code("FailedToSatisfyReadPreference", 133) error_code("XXX_TEMP_NAME_ReadCommittedCurrentlyUnavailable", 134) error_code("StaleTerm", 135) error_code("CappedPositionLost", 136) error_code("IncompatibleShardingConfigVersion", 137) error_code("RemoteOplogStale", 138) error_code("JSInterpreterFailure", 139) # Non-sequential error codes (for compatibility only) error_code("NotMaster", 10107) #this comes from assert_util.h error_code("DuplicateKey", 11000) error_code("InterruptedAtShutdown", 11600) error_code("Interrupted", 11601) error_code("OutOfDiskSpace", 14031 ) error_code("KeyTooLong", 17280); error_code("BackgroundOperationInProgressForDatabase", 12586); error_code("BackgroundOperationInProgressForNamespace", 12587); error_code("NotMasterOrSecondaryCode", 13436); error_code("NotMasterNoSlaveOkCode", 13435); error_code("ShardKeyTooBig", 13334); error_code("SendStaleConfig", 13388); error_code("DatabaseDifferCase", 13297); error_code("PrepareConfigsFailedCode", 13104); error_class("NetworkError", ["HostUnreachable", "HostNotFound", "NetworkTimeout"]) error_class("Interruption", ["Interrupted", "InterruptedAtShutdown", "ExceededTimeLimit"]) error_class("IndexCreationError", ["CannotCreateIndex", "IndexOptionsConflict", "IndexKeySpecsConflict", "IndexAlreadyExists"])