Permalink
Browse files

ENH Better error message

  • Loading branch information...
1 parent 83d51dc commit d05b0bb0bb0ee6ed080ca2141c06082ff1a0ec9b @luispedro committed Jun 1, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 Data/NGH/Formats/Sam.hs
View
@@ -20,7 +20,8 @@ readAlignments' (l:ls)
| otherwise = (readSamLine l:readAlignments' ls)
readSamLine :: L.ByteString -> SamLine
-readSamLine line = SamLine
+readSamLine line = case L8.split '\t' line of
+ [tk0,tk1,tk2,tk3,tk4,tk5,tk6,tk7,tk8,tk9,tk10] -> SamLine
(strict tk0)
(read $ L8.unpack tk1)
(strict tk2)
@@ -32,8 +33,7 @@ readSamLine line = SamLine
(read $ L8.unpack tk8)
(strict tk9)
(strict tk10)
- where
- [tk0,tk1,tk2,tk3,tk4,tk5,tk6,tk7,tk8,tk9,tk10] = L8.split '\t' line
+ tokens -> error $ concat ["Expected 11 tokens, only got ", show $ length tokens,"\n\t\tLine was '", show line, "'"]
strict :: L.ByteString -> S.ByteString
strict = S.concat . L.toChunks

0 comments on commit d05b0bb

Please sign in to comment.