Skip to content

Commit 3b89fff

Browse files
committed
Raise error if decoding fails
1 parent c513048 commit 3b89fff

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/galaxy/tools/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4648,8 +4648,11 @@ def add_copied_value_to_new_elements(new_label, dce_object, columns):
46484648
new_rows[new_label] = columns
46494649

46504650
new_labels_path = new_labels_dataset_assoc.get_file_name()
4651-
with open(new_labels_path) as fh:
4652-
new_labels = fh.readlines(1024 * 1000000)
4651+
try:
4652+
with open(new_labels_path) as fh:
4653+
new_labels = fh.readlines(1024 * 1000000)
4654+
except UnicodeDecodeError:
4655+
raise exceptions.MessageException("Please re-save the file as UTF-8 and try again.")
46534656
if strict and len(hdca.collection.elements) != len(new_labels):
46544657
raise exceptions.MessageException("Relabel mapping file contains incorrect number of identifiers")
46554658
if how_type in ["tabular", "tabular_extended"]:

0 commit comments

Comments
 (0)