Current section
Files
Jump to
Current section
Files
lib/elixir_lib/JuspayException.ex
defmodule Juspay.Exception do
@moduledoc false
defp juspay_error(msg,http_status,json_body) do
response = "\n"
response = case http_status do
0 -> response
_-> response <> "Request failed with httpResponseCode : " <> http_status
end
response = case json_body do
nil -> response
_-> response <> "\nRequest failed with response: " <> json_body
end
response = response <> "\nMessage : " <> msg
end
def invalidArgumentError(msg \\ "Error! Please pass required parameters",http_status \\ 0,json_body \\ nil) do
juspay_error(msg,http_status,json_body)
end
def authenticationError(msg \\"Authentication Error",http_status \\0,json_body \\ nil) do
juspay_error(msg,http_status,json_body)
end
def apiError(msg \\"Internal Server Error",http_status \\0,json_body \\ nil) do
juspay_error(msg,http_status,json_body)
end
def invalidRequestError(msg \\"Invalid request",http_status \\0,json_body \\ nil) do
juspay_error(msg,http_status,json_body)
end
def apiConnectionError(msg \\"Connection error",http_status \\0,json_body \\ nil) do
juspay_error(msg,http_status,json_body)
end
end