iijlab / direct-hs

Client library for https://direct4b.com in Haskell
8 stars 1 forks source link

Map.decodeTalkRoom raises error #37

Closed kakkun61 closed 5 years ago

kakkun61 commented 5 years ago

Problem

Web.Direct.Map.decodeTalkRoom enters the error case below.

            | tp == 2 = case look "talk_name" m of
                Just (M.ObjectStr tname) -> GroupTalk tname
                _                        -> error "decodeTalkRoom"

I confirm that the m whose type is Data.MessagePack.Object actually doesn't have the talk_name field.

Fix

How to fix this?

One idea is below.

            | tp == 2 = case look "talk_name" m of
                Just (M.ObjectStr tname) -> GroupTalk tname
                _                        -> GroupTalk ""