Skip to content

fix: use invalid cron value in error msg instead of undefined e - #91

Open
Andrej730 wants to merge 1 commit into
PostHog:mainfrom
Andrej730:fix-cron-error-message
Open

fix: use invalid cron value in error msg instead of undefined e#91
Andrej730 wants to merge 1 commit into
PostHog:mainfrom
Andrej730:fix-cron-error-message

Conversation

@Andrej730

@Andrej730 Andrej730 commented Aug 1, 2026

Copy link
Copy Markdown

Hello. Noticed unbound variable e in ScheduledBackupSerializer.validate() - probably didn't cause any harm since it was about to raise another error anyway, though it wouldn't be expected ValidationError.

def validate(self, data):
if data.get("schedule") and not croniter.is_valid(data["schedule"]):
raise serializers.ValidationError(f"Invalid cron expression: {e}")
if data.get("incremental_schedule") and not croniter.is_valid(data["incremental_schedule"]):
raise serializers.ValidationError(f"Invalid cron expression: {e}")
return data

Checked the history, it was there from the start, when it was added in 0cb928c:

https://github.com/PostHog/HouseWatch/blame/0cb928cd55c4b767dc0a6483df14c432ee1339f6/housewatch/api/backups.py#L40-L49

Fixed it by including schedule/incremental_schedule in the error instead.

@feliperalmeida can you please take a look?

@Andrej730
Andrej730 force-pushed the fix-cron-error-message branch from 14f3208 to c6d4a84 Compare August 1, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant