Skip to content

Commit 9cbb16d

Browse files
committed
Merge branch 'feature/better-tabular-error' into develop
[ENG-9900]
2 parents 920b1ce + ec064ef commit 9cbb16d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

mfr/core/exceptions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,15 @@ def __init__(self, message, *args, metadata_url: str = '', response: str = '', *
146146
'response': self.response
147147
}])
148148

149-
class CorruptedError(RendererError):
150149

151-
__TYPE = 'corrupted'
150+
class UnparseableTableError(RendererError):
151+
152+
__TYPE = 'unparseable_table'
152153

153154
def __init__(self, *args, renderer_class: str = '', **kwargs):
154-
super().__init__("File is corrupted, impossible to render, please check it's integrity", *args, renderer_class, **kwargs)
155+
super().__init__("File is not loading. Please check its integrity by downloading.",
156+
*args, renderer_class, **kwargs)
157+
155158

156159
class TooBigToRenderError(ProviderError):
157160
"""If the user tries to render a file larger than a server specified maximum, throw a

mfr/extensions/tabular/utilities.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from tempfile import NamedTemporaryFile
99

1010
from mfr.extensions.tabular import compat
11-
from mfr.core.exceptions import SubprocessError, CorruptedError
11+
from mfr.core.exceptions import SubprocessError, UnparseableTableError
1212
from mfr.extensions.tabular.settings import (PSPP_CONVERT_BIN,
1313
PSPP_CONVERT_TIMEOUT,
1414
MAX_SIZE)
@@ -126,7 +126,7 @@ def _extract_rows(fields, raw_rows):
126126
def parse_xls(wb, sheets):
127127
for sheet in wb.sheets():
128128
if getattr(sheet, 'nrows', None) is None or getattr(sheet, 'ncols', None) is None:
129-
raise CorruptedError
129+
raise UnparseableTableError
130130

131131
ncols = sheet.ncols
132132
max_cols = min(ncols, MAX_SIZE)
@@ -145,7 +145,7 @@ def parse_xlsx(wb, sheets):
145145
ws = wb[name]
146146

147147
if getattr(ws, 'max_row', None) is None or getattr(ws, 'max_column', None) is None:
148-
raise CorruptedError
148+
raise UnparseableTableError
149149

150150
ncols = getattr(ws, "max_column", 0)
151151
max_cols = min(ncols, MAX_SIZE)

0 commit comments

Comments
 (0)