Closed ctreffe closed 3 years ago
When creating a new web experiment with a title that has already been given to another web experiment an unhandled exception occurs:
[2019-04-17 10:37:15,105] ERROR in app: Exception on /experiment/new [POST] Traceback (most recent call last): File "C:\venv\alfred3\lib\site-packages\mongoengine\document.py", line 389, in save object_id = self._save_create(doc, force_insert, write_concern) File "C:\venv\alfred3\lib\site-packages\mongoengine\document.py", line 452, in _save_create object_id = wc_collection.insert_one(doc).inserted_id File "C:\venv\alfred3\lib\site-packages\pymongo\collection.py", line 693, in insert_one session=session), File "C:\venv\alfred3\lib\site-packages\pymongo\collection.py", line 607, in _insert bypass_doc_val, session) File "C:\venv\alfred3\lib\site-packages\pymongo\collection.py", line 595, in _insert_one acknowledged, _insert_command, session) File "C:\venv\alfred3\lib\site-packages\pymongo\mongo_client.py", line 1248, in _retryable_write return self._retry_with_session(retryable, func, s, None) File "C:\venv\alfred3\lib\site-packages\pymongo\mongo_client.py", line 1201, in _retry_with_session return func(session, sock_info, retryable) File "C:\venv\alfred3\lib\site-packages\pymongo\collection.py", line 592, in _insert_command _check_write_command_response(result) File "C:\venv\alfred3\lib\site-packages\pymongo\helpers.py", line 217, in _check_write_command_response _raise_last_write_error(write_errors) File "C:\venv\alfred3\lib\site-packages\pymongo\helpers.py", line 198, in _raise_last_write_error raise DuplicateKeyError(error.get("errmsg"), 11000, error) pymongo.errors.DuplicateKeyError: E11000 duplicate key error collection: mortimer.web_experiment index: version_1_title_1 dup key: { : null, : "Test" }
This exception should be handled or prevented by a previous check for duplicate web experiment titles.
I'm not able to reproduce this bug - on my trials, the event is handled correctly with a display of a message informing the user about the duplicate title (see picture).
When creating a new web experiment with a title that has already been given to another web experiment an unhandled exception occurs:
This exception should be handled or prevented by a previous check for duplicate web experiment titles.