~singpolyma/cheogram

8868a2f15284017511924b79bc4539e26bc13617 — Stephen Paul Weber 5 years ago 03d0371
Handle errors from backend gateway

Well, log them for now.  Need to send more data along if we're going to
reflect them back properly.
1 files changed, 5 insertions(+), 4 deletions(-)

M Main.hs
M Main.hs => Main.hs +5 -4
@@ 790,10 790,11 @@ component db backendHost toRoomPresences toRejoinManager toJoinPartDebouncer toC
		liftIO $ case s of
			(ReceivedMessage m@(Message { messageFrom = Just from, messageTo = Just to }))
				| strDomain (jidDomain from) == backendHost,
				  messageType m /= MessageError,
				  Just txt <- getBody "jabber:component:accept" m,
				  Just cheoJid <- mapToComponent from ->
					mapM_ sendToComponent =<< processSMS db componentJid conferenceServers from cheoJid txt
				  to == componentJid ->
					case (messageType m, getBody "jabber:component:accept" m, mapToComponent from) of
						(MessageError, _, _) -> log "backend error" s
						(_, Just txt, Just cheoJid) ->
							mapM_ sendToComponent =<< processSMS db componentJid conferenceServers from cheoJid txt
			_ ->
				mapM_ sendToComponent =<< componentStanza db (mapToBackend backendHost) toRoomPresences toRejoinManager toJoinPartDebouncer componentJid s
	where