I am trying to figure out where an exception is thrown. These are my first experiences with exception handling in Haskell. I am trying to call an XML-RPC function on a remote host, that is accessed using https:
ghci> import Network.XmlRpc.Client
ghci> import Network.XmlRpc.Internals
ghci> remote "https://rpc.ote.gandi.net/xmlrpc/" "domain.count" (ValueString "01234567890ABCDEF")
*** Exception: user error (https not supported)
In order to figure out if I just forgot to enable SSL support in some package or if it's something different, I would like to know which package throws the exception.
I started by following the instructions in the GHC docs , but it is not working out as expected:
ghci> :set -fbreak-on-exception
ghci> :trace remote "https://rpc.ote.gandi.net/xmlrpc/" "domain.count" (ValueString "01234567890ABCDEF")
Stopped at <exception thrown>
_exception :: e = _
ghci> :hist
Empty history. Perhaps you forgot to use :trace?
All relevant packages should be compiled with --enable-library-profiling
.
How to locate the exception?
The reason you couldn't get any good information out of it is that :trace
can't go into library code -- we need to interpret any code we want to trace. Whether it was compiled with profiling is irrelevant. After installing some dependencies, I did this to get some more information:
% cabal unpack haxr
% cd haxr-3000.8.5
% ghci Network/XmlRpc/Client.hs -XOverlappingInstances -XTypeSynonymInstances -XFlexibleInstances -XTemplateHaskell
*Network.XmlRpc.Client> :set -fbreak-on-exception
*Network.XmlRpc.Client> :trace remote "https://rpc.ote.gandi.net/xmlrpc/" "domain.count" (ValueString "01234567890ABCDEF")
Stopped at <exception thrown>
_exception :: e = _
[<exception thrown>] *Network.XmlRpc.Client> :hist
-1 : authHdr (Network/XmlRpc/Client.hs:169:27-33)
-2 : request:parseUserInfo (Network/XmlRpc/Client.hs:161:34-40)
-3 : request:parseUserInfo (Network/XmlRpc/Client.hs:161:31-73)
-4 : request:parseUserInfo:(...) (Network/XmlRpc/Client.hs:159:55-70)
-5 : request:parseUserInfo:(...) (Network/XmlRpc/Client.hs:159:39-51)
-6 : request:parseUserInfo:(...) (Network/XmlRpc/Client.hs:159:39-70)
-7 : request:parseUserInfo (Network/XmlRpc/Client.hs:160:34-39)
-8 : request:parseUserInfo (Network/XmlRpc/Client.hs:160:31-64)
-9 : request:parseUserInfo (Network/XmlRpc/Client.hs:(160,29)-(161,74))
-10 : request:parseUserInfo (Network/XmlRpc/Client.hs:(159,5)-(161,74))
-11 : authHdr (Network/XmlRpc/Client.hs:(169,1)-(175,60))
-12 : request:headers (Network/XmlRpc/Client.hs:158:33-47)
-13 : request:headers (Network/XmlRpc/Client.hs:158:33-63)
-14 : request:headers (Network/XmlRpc/Client.hs:158:33-70)
-15 : request:headers (Network/XmlRpc/Client.hs:158:20-71)
-16 : request:headers (Network/XmlRpc/Client.hs:157:16-65)
-17 : request:headers (Network/XmlRpc/Client.hs:156:16-47)
-18 : request:headers (Network/XmlRpc/Client.hs:155:16-44)
-19 : request:headers (Network/XmlRpc/Client.hs:(155,15)-(158,71))
-20 : request (Network/XmlRpc/Client.hs:(149,28)-(152,54))
...
Hopefully that gets you started. You may find that this leads you to another library boundary -- if so, you'll need to unpack and interpret that library to go deeper. Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.