]> www.average.org Git - pdns-pipe-nmc.git/blobdiff - pdns-pipe-nmc.hs
handle empty 'value' as domain with no data
[pdns-pipe-nmc.git] / pdns-pipe-nmc.hs
index ee5bd3771a900dd880f2add5c7dcacff6a100ae9..9e4a72930691ab6b58e53e6220c4d6c495c5e4ce 100644 (file)
@@ -43,9 +43,12 @@ qRsp rsp =
     case parseJsonRpc (responseBody rsp) :: Either JsonRpcError NmcRes of
       Left  jerr -> Left $ "Unparseable response: " ++ (show (responseBody rsp))
       Right jrsp ->
-        case decode (resValue jrsp) :: Maybe NmcDom of
-          Nothing  -> Left $ "Unparseable value: " ++ (show (resValue jrsp))
-          Just dom -> Right dom
+        case resValue jrsp of
+          "" -> Right emptyNmcDom
+          vstr ->
+            case decode vstr :: Maybe NmcDom of
+              Nothing  -> Left $ "Unparseable value: " ++ (show vstr)
+              Just dom -> Right dom
 
 -- NMC interface