@@ -91,14 +91,18 @@ readDocx :: PandocMonad m
9191 => ReaderOptions
9292 -> B.ByteString
9393 -> m Pandoc
94−readDocx opts bytes
95− | Right archive <- toArchiveOrFail bytes
96− , Right (docx, parserWarnings) <- archiveToDocxWithWarnings archive = do
97− mapM_ (P.report . DocxParserWarning) parserWarnings
98− (meta, blks) <- docxToOutput opts docx
99− return $ Pandoc meta blks
100−readDocx _ _ =
101− throwError $ PandocSomeError "couldn't parse docx file"
94+readDocx opts bytes = do
95+ case toArchiveOrFail bytes of
96+ Right archive -> do
97+ case archiveToDocxWithWarnings archive of
98+ Right (docx, parserWarnings) -> do
99+ mapM_ (P.report . DocxParserWarning) parserWarnings
100+ (meta, blks) <- docxToOutput opts docx
101+ return $ Pandoc meta blks
102+ Left docxerr -> throwError $ PandocSomeError $
103+ "couldn't parse docx file: " <> T.pack (show docxerr)
104+ Left err -> throwError $ PandocSomeError $
105+ "couldn't unpack docx container: " <> T.pack err
102106
103107data DState = DState { docxAnchorMap :: M.Map T.Text T.Text
104108 , docxAnchorSet :: Set.Set T.Text