aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kierán Meinhardt <kmein@posteo.de>2024-10-12 10:33:41 +0200
committerLibravatar Kierán Meinhardt <kmein@posteo.de>2024-10-12 10:35:11 +0200
commita313d638bb22fed46a8d701fefde28391d897185 (patch)
treef02242f86a617439f980a822796a8e3d75a1cb7a
parent6d356977af31903ccb8fc81ce87cc4a003792205 (diff)
exhaust pattern matches
-rw-r--r--backend/app/Main.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/backend/app/Main.hs b/backend/app/Main.hs
index 7ddb475..e7753d7 100644
--- a/backend/app/Main.hs
+++ b/backend/app/Main.hs
@@ -110,6 +110,7 @@ fromAutoTypes path (U.Object ps) =
toProperty (U.Option (Just (U.Scalar "string"))) = "string?" :: String
toProperty (U.Reference i) = "$ref:" <> i
toProperty x = error ("unhandled type: " <> show x)
+fromAutoTypes _ _ = error "Only JSON objects are supported."
watch :: TMVar Repo -> FilePath -> G.RefName -> IO ()
watch repoT root ref = do
@@ -293,4 +294,5 @@ restApi root ref repoT app req respond =
let [collection] = filter ((== c) . (.path)) (last repo.commits).collections
respond . W.responseLBS W.status200 [] $
J.encode (fromAutoTypes c collection.schema)
+ (method, path) -> fail $ "Method " ++ show method ++ " on route " ++ show path ++ " not supported."
_ -> app req respond