aboutsummaryrefslogtreecommitdiff
path: root/src/serializers/error_serializer.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/serializers/error_serializer.cr')
-rw-r--r--src/serializers/error_serializer.cr14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/serializers/error_serializer.cr b/src/serializers/error_serializer.cr
new file mode 100644
index 0000000..21a53aa
--- /dev/null
+++ b/src/serializers/error_serializer.cr
@@ -0,0 +1,14 @@
+# This is the default error serializer generated by Lucky.
+# Feel free to customize it in any way you like.
+class ErrorSerializer < BaseSerializer
+ def initialize(
+ @message : String,
+ @details : String? = nil,
+ @param : String? = nil # so you can track which param (if any) caused the problem
+ )
+ end
+
+ def render
+ {message: @message, param: @param, details: @details}
+ end
+end