Skip to content

Commit 2606fed

Browse files
Update exception/error text
- Fix typo - Add study open/close dates
1 parent 833dbae commit 2606fed

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

edc_consent/consent_definition.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,15 @@ def check_date_within_study_period(self) -> None:
180180
<= getattr(self, attr)
181181
<= ceil_secs(study_close_datetime)
182182
):
183-
date_string = formatted_datetime(getattr(self, attr))
183+
open_date_string = formatted_datetime(study_open_datetime)
184+
close_date_string = formatted_datetime(study_close_datetime)
185+
attr_date_string = formatted_datetime(getattr(self, attr))
184186
raise ConsentDefinitionError(
185-
f"Invalid {attr} date. Cannot be before study start date. "
186-
f"See {self}. Got {date_string}."
187+
f"Invalid {attr} date. "
188+
f"Must be within the opening and closing dates of the protocol. "
189+
f"See {self}. "
190+
f"Got {open_date_string=}, {close_date_string=}, "
191+
f"{attr=}, {attr_date_string=}."
187192
)
188193

189194
def get_previous_consent(

0 commit comments

Comments
 (0)