Skip to content

Commit

Permalink
Catch validation errors during CP save_revision() as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jerith committed Jan 29, 2024
1 parent 9d9cb68 commit ba9cf06
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions home/import_content_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,11 @@ def save(self, parent: Page) -> None:
try:
with contextlib.suppress(NodeAlreadySaved):
parent.add_child(instance=page)
page.save_revision().publish()
except ValidationError as err:
# FIXME: Find a better way to represent this.
raise ImportException(f"Validation error: {err}", self.row_num)

page.save_revision().publish()

def add_web_to_page(self, page: ContentPage) -> None:
page.enable_web = self.enable_web
page.title = self.title
Expand Down

0 comments on commit ba9cf06

Please sign in to comment.