From 94e83cdfb36fd889c3657d1fbe389747b175a969 Mon Sep 17 00:00:00 2001 From: DawoudSheraz Date: Thu, 21 Nov 2019 16:53:21 +0500 Subject: [PATCH] log section and subsection information during URL retrieval failure --- cms/djangoapps/contentstore/utils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index 895e92277a..baaf4ff535 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -546,7 +546,15 @@ def get_sibling_urls(subsection): break last_block = block if not prev_loc: - sections = section.get_parent().get_children() + try: + sections = section.get_parent().get_children() + except AttributeError: + log.error(u"Error retrieving URLs in subsection {subsection} included in section {section}".format( + section=section.location, + subsection=subsection.location + )) + raise + try: prev_section = sections[sections.index(section) - 1] prev_loc = prev_section.get_children()[-1].get_children()[-1].location