Show better error message when changing plans fails

pull/949/head
Uku Taht 6 years ago
parent ba6b897fe6
commit e1bb436846

@ -47,9 +47,23 @@ defmodule PlausibleWeb.BillingController do
|> redirect(to: "/settings")
{:error, e} ->
# https://developer.paddle.com/api-reference/intro/api-error-codes
msg =
case e do
%{"code" => 147} ->
"We were unable to charge your card. Make sure your payment details are up to date and try again."
%{"message" => msg} when not is_nil(msg) ->
msg
_ ->
"Something went wrong. Please try again or contact support at support@plausible.io"
end
Sentry.capture_message("Error changing plans",
extra: %{
errors: inspect(e),
message: msg,
new_plan_id: new_plan_id,
user_id: conn.assigns[:current_user].id
}

Loading…
Cancel
Save