Skip to content

Commit

Permalink
Merge pull request #145 from vjmarteau/Add_print_error_fun
Browse files Browse the repository at this point in the history
Add def for print_error function
  • Loading branch information
apeltzer committed Sep 22, 2022
2 parents 73b4a29 + 66d2e2f commit 124f497
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/check_samplesheet.py
Expand Up @@ -140,6 +140,12 @@ def read_head(handle, num_lines=10):
lines.append(line)
return "".join(lines)

def print_error(error, context="Line", context_str=""):
error_str = f"ERROR: Please check samplesheet -> {error}"
if context != "" and context_str != "":
error_str = f"ERROR: Please check samplesheet -> {error}\n{context.strip()}: '{context_str.strip()}'"
print(error_str)
sys.exit(1)

def sniff_format(handle):
"""
Expand Down

0 comments on commit 124f497

Please sign in to comment.