Skip to content

Commit

Permalink
Improved error messaging
Browse files Browse the repository at this point in the history
• quote with `
• use mkString to avoid showing `List()`
  • Loading branch information
mtomko committed Apr 18, 2024
1 parent a46b13b commit 2c264ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object BarcodeSet:
.asScala
.toList
.map(_.trim)
.traverse(parseBarcode(s => InvalidFileException(file, s"Invalid DNA barcode '$s'")))
.traverse(parseBarcode(s => InvalidFileException(file, s"Invalid DNA barcode `$s`")))
.map(bcs => new BarcodeSet(bcs.toSet))
.flatTap(checkSet(file, _))
.get // throws if an error was encountered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ object ReferenceData:
// and reject cases where the barcode is empty but the ID is non-empty
if barcode.isEmpty && id.isEmpty then None
else if isReferenceBarcode(barcode) then Some(ReferenceEntry(barcode, id))
else throw InvalidFileException(file, s"Invalid DNA barcode '$barcode' for ID '$id'")
else throw InvalidFileException(file, s"Invalid DNA barcode '$barcode' for ID `$id`")
case _ =>
throw InvalidFileException(
file,
s"Incorrect number of columns. At least 2 required, got: ${xs.length}: $xs"
s"Incorrect number of columns. At least 2 required, got: ${xs.length}: ${xs.mkString("`", "`, `", "`")}"
)
}

Expand Down

0 comments on commit 2c264ce

Please sign in to comment.