forked from AkkomaGang/akkoma
Deal with target not found error in add_alias
Ref: emit-move
This commit is contained in:
parent
3fd13b70ec
commit
9a27cb4f9d
2 changed files with 7 additions and 1 deletions
|
@ -293,7 +293,8 @@ def add_alias_operation do
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
400 => Operation.response("Error", "application/json", ApiError),
|
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
|
end
|
||||||
|
|
|
@ -196,6 +196,11 @@ def add_alias(%{assigns: %{user: user}, body_params: body_params} = conn, _) do
|
||||||
{:ok, _user} <- user |> User.add_alias(alias_user) do
|
{:ok, _user} <- user |> User.add_alias(alias_user) do
|
||||||
json(conn, %{status: "success"})
|
json(conn, %{status: "success"})
|
||||||
else
|
else
|
||||||
|
{:not_found, _} ->
|
||||||
|
conn
|
||||||
|
|> put_status(404)
|
||||||
|
|> json(%{error: "Target account does not exist."})
|
||||||
|
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
json(conn, %{error: error})
|
json(conn, %{error: error})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue