From 52c874ab42cd266d1b26ce1c045fcaf8eb410b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 7 Oct 2024 22:17:40 +0200 Subject: Handle unknown object type Changelog: Handle unknown object type --- main/Test/Service.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'main/Test') diff --git a/main/Test/Service.hs b/main/Test/Service.hs index 1018e0d..3e6eb83 100644 --- a/main/Test/Service.hs +++ b/main/Test/Service.hs @@ -14,7 +14,7 @@ import Erebos.Storage data TestMessage = TestMessage (Stored Object) data TestMessageAttributes = TestMessageAttributes - { testMessageReceived :: String -> String -> String -> ServiceHandler TestMessage () + { testMessageReceived :: Object -> String -> String -> String -> ServiceHandler TestMessage () } instance Storable TestMessage where @@ -25,12 +25,13 @@ instance Service TestMessage where serviceID _ = mkServiceID "cb46b92c-9203-4694-8370-8742d8ac9dc8" type ServiceAttributes TestMessage = TestMessageAttributes - defaultServiceAttributes _ = TestMessageAttributes (\_ _ _ -> return ()) + defaultServiceAttributes _ = TestMessageAttributes (\_ _ _ _ -> return ()) serviceHandler smsg = do let TestMessage sobj = fromStored smsg - case map BL.unpack $ BL.words $ BL.takeWhile (/='\n') $ serializeObject $ fromStored sobj of + obj = fromStored sobj + case map BL.unpack $ BL.words $ BL.takeWhile (/='\n') $ serializeObject obj of [otype, len] -> do cb <- asks $ testMessageReceived . svcAttributes - cb otype len (show $ refDigest $ storedRef sobj) + cb obj otype len (show $ refDigest $ storedRef sobj) _ -> return () -- cgit v1.2.3