Skip to content

Commit 465be94

Browse files
author
Gerit Wagner
committed
add info on ReviewManagerNotNotifiedError
1 parent 2e4d385 commit 465be94

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

colrev/exceptions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ class ReviewManagerNotNotifiedError(CoLRevException):
9090

9191
def __init__(self) -> None:
9292
self.message = (
93-
"Create an operation and inform the review manager in advance"
94-
+ " to avoid conflicts."
93+
"Instantiate the intended operation so the review manager can "
94+
"run its precondition checks before accessing records.\n"
95+
"More details: "
96+
"https://colrev-environment.github.io/colrev/dev_docs/colrev.exceptions.ReviewManagerNotNotifiedError.html"
9597
)
9698
super().__init__(self.message)
9799

docs/source/dev_docs/colrev.exceptions.ReviewManagerNotNotifiedError.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,35 @@ colrev.exceptions.ReviewManagerNotNotifiedError
44
.. currentmodule:: colrev.exceptions
55

66
.. autoexception:: ReviewManagerNotNotifiedError
7+
8+
``Dataset.load_records_dict()`` refuses to return data until the review
9+
manager knows which operation is about to run. It expects the
10+
:class:`~colrev.review_manager.ReviewManager` to have its
11+
``notified_next_operation`` flag set, otherwise it raises this exception.
12+
Creating an operation immediately calls :meth:`Operation.notify()
13+
<colrev.operation.Operation.notify>` which sets that flag and runs the
14+
operation's precondition checks. In other words, you do *not* need to call
15+
``notify()`` manually; instantiating the desired operation is enough.
16+
17+
The notification gate exists to prevent two classes of errors:
18+
19+
* **Dirty working tree issues** –
20+
:meth:`Operation.check_precondition()
21+
<colrev.operation.Operation.check_precondition>` ensures the repository is
22+
clean before state-changing work begins. It raises
23+
:class:`~colrev.exceptions.UnstagedGitChangesError` when modifications are
24+
unstaged and :class:`~colrev.exceptions.CleanRepoRequiredError` when tracked
25+
files outside the ignore list would be overwritten. By forcing dataset
26+
access to go through an operation, these safeguards always execute before
27+
records are read or written.
28+
* **Process-order violations** – the same precondition routine verifies that
29+
the requested operation is valid given each record's current status. It can
30+
raise :class:`~colrev.exceptions.ProcessOrderViolation` if earlier steps are
31+
missing or :class:`~colrev.exceptions.NoRecordsError` if work other than
32+
loading is attempted before any records exist. Requiring notification makes
33+
sure these workflow errors are caught instead of letting scripts bypass the
34+
process model.
35+
36+
``ReviewManagerNotNotifiedError`` therefore ensures that every dataset access
37+
is routed through an operation, keeping the repository cleanliness and
38+
process-order checks in place.

0 commit comments

Comments
 (0)