Beispiel #1
0
bool
mongoc_cursor_error (mongoc_cursor_t *cursor,
                     bson_error_t    *error)
{
   bool ret;

   BSON_ASSERT(cursor);

   if (cursor->iface.error) {
      ret = cursor->iface.error(cursor, error);
   } else {
      ret = _mongoc_cursor_error(cursor, error);
   }

   if (ret && error) {
      /*
       * Rewrite the error code if we are talking to an older mongod
       * and the command was not found. It used to simply return an
       * error code of 17 and we can synthesize 59.
       *
       * Additionally, old versions of mongos may send 13390 indicating
       * unrecognized command.
       */
      if (cursor->is_command &&
          ((error->code == MONGOC_ERROR_PROTOCOL_ERROR) ||
           (error->code == 13390))) {
         error->code = MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND;
      }
   }

   RETURN(ret);
}
bson_bool_t
mongoc_cursor_error (mongoc_cursor_t *cursor,
                     bson_error_t    *error)
{
   bson_bool_t ret;

   BSON_ASSERT(cursor);

   if (cursor->interface.error) {
      ret = cursor->interface.error(cursor, error);
   } else {
      ret = _mongoc_cursor_error(cursor, error);
   }

   if (ret && error) {
      /*
       * Rewrite the error code if we are talking to an older mongod
       * and the command was not found. It used to simply return an
       * error code of 17 and we can synthesize 59.
       */
      if (cursor->is_command &&
          (cursor->client->cluster.wire_version == 0) &&
          (error->code == MONGOC_ERROR_PROTOCOL_ERROR)) {
         error->code = MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND;
      }
   }

   RETURN(ret);
}
static bool
_mongoc_cursor_array_error  (mongoc_cursor_t *cursor,
                             bson_error_t    *error)
{
   mongoc_cursor_array_t *arr;

   ENTRY;

   arr = (mongoc_cursor_array_t *)cursor->iface_data;

   if (arr->has_synthetic_bson) {
      return false;
   } else {
      return _mongoc_cursor_error(cursor, error);
   }
}
Beispiel #4
0
bson_bool_t
mongoc_cursor_error (mongoc_cursor_t *cursor,
                     bson_error_t    *error)
{
   bson_bool_t ret;

   BSON_ASSERT(cursor);

   if (cursor->interface.error) {
      ret = cursor->interface.error(cursor, error);
   } else {
      ret = _mongoc_cursor_error(cursor, error);
   }

   RETURN(ret);
}