diff options
author | Tusooa Zhu <tusooa@kazv.moe> | 2021-09-22 19:27:04 -0400 |
---|---|---|
committer | Tusooa Zhu <tusooa@kazv.moe> | 2021-12-28 01:11:08 -0500 |
commit | 9a27cb4f9d314fe1066f566de71357f55926116e (patch) | |
tree | 7575341d051e6c3a4eca682184ba9e1a7abdf7ef | |
parent | 3fd13b70ec7c8e9faca46550fe02b51ccbeaebd0 (diff) | |
download | pleroma-9a27cb4f9d314fe1066f566de71357f55926116e.tar.gz |
Deal with target not found error in add_alias
Ref: emit-move
-rw-r--r-- | lib/pleroma/web/api_spec/operations/twitter_util_operation.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/twitter_api/controllers/util_controller.ex | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex b/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex index fbaeb8da3..4a2a246f5 100644 --- a/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex +++ b/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex @@ -293,7 +293,8 @@ defmodule Pleroma.Web.ApiSpec.TwitterUtilOperation do } }), 400 => Operation.response("Error", "application/json", ApiError), - 403 => Operation.response("Error", "application/json", ApiError) + 403 => Operation.response("Error", "application/json", ApiError), + 404 => Operation.response("Error", "application/json", ApiError) } } end diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index c076671d4..b8abc666e 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -196,6 +196,11 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do {:ok, _user} <- user |> User.add_alias(alias_user) do json(conn, %{status: "success"}) else + {:not_found, _} -> + conn + |> put_status(404) + |> json(%{error: "Target account does not exist."}) + {:error, error} -> json(conn, %{error: error}) end |