If I run this code, which creates a t
if it doesn’t exist already:
lookupOrCreate : (HasCreate t, HasFetchByKey t t) => t -> Update t
lookupOrCreate =
try fst <$> fetchByKey t
catch _ -> create t
The catch
will not trigger, and I get an error
Attempt to fetch or exercise by key but no contract with that key was found.
I suppose I can work around this by using lookupByKey
, but I’m curious to understand why this exception is not captured?