From bec4490efba04f04d15b046192eabb06b6704b4a Mon Sep 17 00:00:00 2001
From: Philipp Balzarek
Date: Mon, 4 Mar 2013 15:14:36 +0100
Subject: [PATCH] pretty print unpickle errors in error messages
---
source/Network/Xmpp/Stream.hs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs
index e885d19..7ce9ba7 100644
--- a/source/Network/Xmpp/Stream.hs
+++ b/source/Network/Xmpp/Stream.hs
@@ -60,7 +60,8 @@ streamUnpickleElem :: PU [Node] a
-> StreamSink a
streamUnpickleElem p x = do
case unpickleElem p x of
- Left l -> throwError $ XmppOtherFailure "Unpickle error"
+ Left l -> throwError $ XmppOtherFailure ("Unpickle error"
+ ++ ppUnpickleError l)
-- TODO: Log: StreamXmlError (show l)
Right r -> return r
@@ -356,8 +357,9 @@ pullUnpickle p = do
Right elem' -> do
let res = unpickleElem p elem'
case res of
- Left e -> return . Left $ XmppOtherFailure
- "pullUnpickle: unpickle failed" -- TODO: Log
+ Left e -> return . Left . XmppOtherFailure $
+ "pullUnpickle: unpickle failed" ++ ppUnpickleError e
+ -- TODO: Log
Right r -> return $ Right r
-- | Pulls a stanza (or stream error) from the stream.