Skip to content

Commit

Permalink
Merge pull request #33 from enobayram/fail-with-fail-in-from-json
Browse files Browse the repository at this point in the history
Fail with Prelude.fail in FromJSON instances
  • Loading branch information
alevy authored Mar 3, 2021
2 parents ca55227 + 3988706 commit 9316db2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Database/PostgreSQL/ORM/Model.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ instance A.ToJSON DBKey where
instance A.FromJSON DBKey where
parseJSON (A.Number a) = return $ DBKey (floor a)
parseJSON A.Null = return NullKey
parseJSON _ = error "Expected Number or Null"
parseJSON _ = fail "Expected Number or Null"

instance Eq DBKey where
(DBKey a) == (DBKey b) = a == b
Expand Down Expand Up @@ -206,7 +206,7 @@ instance A.ToJSON (GDBRef t a) where

instance A.FromJSON (GDBRef t a) where
parseJSON (A.Number n) = return $ DBRef (floor n)
parseJSON _ = error "Expected Number"
parseJSON _ = fail "Expected Number"

instance (Model t) => Show (GDBRef rt t) where
showsPrec n (DBRef k) = showsPrec n k
Expand Down

0 comments on commit 9316db2

Please sign in to comment.