Skip to content

Commit

Permalink
Update exception/error text
Browse files Browse the repository at this point in the history
- Fix typo
- Add study open/close dates
  • Loading branch information
JonathanWillitts committed Sep 17, 2024
1 parent 833dbae commit 2606fed
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions edc_consent/consent_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,15 @@ def check_date_within_study_period(self) -> None:
<= getattr(self, attr)
<= ceil_secs(study_close_datetime)
):
date_string = formatted_datetime(getattr(self, attr))
open_date_string = formatted_datetime(study_open_datetime)
close_date_string = formatted_datetime(study_close_datetime)
attr_date_string = formatted_datetime(getattr(self, attr))
raise ConsentDefinitionError(
f"Invalid {attr} date. Cannot be before study start date. "
f"See {self}. Got {date_string}."
f"Invalid {attr} date. "
f"Must be within the opening and closing dates of the protocol. "
f"See {self}. "
f"Got {open_date_string=}, {close_date_string=}, "
f"{attr=}, {attr_date_string=}."
)

def get_previous_consent(
Expand Down

0 comments on commit 2606fed

Please sign in to comment.