Created
April 28, 2019 12:43
-
-
Save sultaniman/263f9a4f2384da753d2c8df165970c6a to your computer and use it in GitHub Desktop.
Standard API errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule IdpWeb.Schema.Errors do | |
@moduledoc """ | |
Defines common GraphQL error responses | |
""" | |
defmacro __using__(_) do | |
quote do | |
@permission_denied { | |
:error, | |
%{ | |
message: "Permission denied", | |
code: :permission_denied | |
} | |
} | |
@not_found { | |
:error, | |
%{ | |
code: :not_found, | |
message: "Not found" | |
} | |
} | |
@not_authenticated { | |
:error, | |
%{ | |
code: :not_authenticated, | |
message: "Not authenticated" | |
} | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment