From a313d638bb22fed46a8d701fefde28391d897185 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= <kmein@posteo.de>
Date: Sat, 12 Oct 2024 10:33:41 +0200
Subject: exhaust pattern matches

---
 backend/app/Main.hs | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'backend')

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
-- 
cgit v1.2.3