aboutsummaryrefslogtreecommitdiff
path: root/src/Model/MatrixErrorResponse.hs
diff options
context:
space:
mode:
authoradambrangenberg <adabran06@gmail.com>2025-12-24 03:40:10 +0100
committeradambrangenberg <adabran06@gmail.com>2025-12-24 03:40:10 +0100
commita0886694f73fc382d78da79ab8bfb27475757bab (patch)
tree652ba9b603a1acaf4dfca188f7bb2c29c6bccfd0 /src/Model/MatrixErrorResponse.hs
parent2b48a574e8b9fed03a5c1969af4bb1e338f1be26 (diff)
Implemented basic auth, refactor
Diffstat (limited to 'src/Model/MatrixErrorResponse.hs')
-rw-r--r--src/Model/MatrixErrorResponse.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Model/MatrixErrorResponse.hs b/src/Model/MatrixErrorResponse.hs
new file mode 100644
index 0000000..22f5ae5
--- /dev/null
+++ b/src/Model/MatrixErrorResponse.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE DeriveGeneric #-}
+
+module Model.MatrixErrorResponse (MatrixErrorResponse (..)) where
+
+import Data.Aeson
+import GHC.Generics (Generic)
+import Data.Text (Text)
+
+----------------------------------------------------------------------------------------------------
+data MatrixErrorResponse = MatrixErrorResponse
+ { error_code :: Text -- TODO: Enum?
+ , error :: Text
+ } deriving (Eq, Show, Generic)
+
+instance ToJSON MatrixErrorResponse where
+ toJSON = genericToJSON defaultOptions { fieldLabelModifier = \name ->
+ case name of
+ "error_code" -> "errcode"
+ other -> other
+ }