about summary refs log tree commit diff
path: root/src/Types.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-01T10·46+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-01T10·46+0100
commita3732300e1c4dfa14a7ba9d7367ebbef914d8398 (patch)
tree4590cd0112d8f0e41c472e9bfa294a8eb6da6207 /src/Types.hs
parent9666d5dce152f996c7dd2167e0b1a9c2f9f767b0 (diff)
Add exhaustive patterns to FromJSON Role instance
When someone enters something like role=mgr, return a helpful error message to
the user.

Note: I should enable the exhaustive patterns check for GHC.
Diffstat (limited to 'src/Types.hs')
-rw-r--r--src/Types.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Types.hs b/src/Types.hs
index 5026b97383e6..48c26caef0cc 100644
--- a/src/Types.hs
+++ b/src/Types.hs
@@ -114,6 +114,7 @@ instance FromJSON Role where
       "user" -> pure RegularUser
       "manager" -> pure Manager
       "admin" -> pure Admin
+      _ -> fail "Expected \"user\" or \"manager\" or \"admin\""
 
 instance ToField Role where
   toField RegularUser = SQLText "user"