Skip to content

Commit c317b47

Browse files
committed
Better error-handling around patches statement data.
1 parent e8a97f7 commit c317b47

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

reddwarf/data_loader.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,18 @@ def load_remote_export_data(self):
127127
# See: https://github.com/polis-community/red-dwarf/issues/55
128128
if self._is_statement_meta_field_missing():
129129
import warnings
130-
warnings.warn("CSV import is missing is_meta field. Loading comments data from API instead...")
131-
self.load_api_data_report()
132-
self.conversation_id = self.report_data["conversation_id"]
133-
self.load_api_data_comments()
130+
warnings.warn("CSV import is missing is_meta field. Attempting to load comments data from API instead...")
131+
try:
132+
if self.report_id and not self.conversation_id:
133+
self.load_api_data_report()
134+
self.conversation_id = self.report_data["conversation_id"]
135+
self.load_api_data_comments()
136+
except Exception:
137+
raise ValueError(" ".join([
138+
"Due to an upstream bug, we must patch CSV exports using the API,",
139+
"so conversation_id or report_id is required.",
140+
"See: https://github.com/polis-community/red-dwarf/issues/56",
141+
]))
134142

135143
# When multiple votes (same tid and pid), keep only most recent (vs first).
136144
self.filter_duplicate_votes(keep="recent")

0 commit comments

Comments
 (0)