aboutsummaryrefslogtreecommitdiff
path: root/src/Model/MatrixErrorResponse.hs
diff options
context:
space:
mode:
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
+ }