我尝试创建一个名为postgres的用户.我重新安装了postgres brew.我能用它来运行它
postgres -D /usr/local/var/postgres
当我跑步时mix ecto.create,我仍然得到错误:
~/code/blog_phoenix:.mix ecto.create
** (Mix) The database for BlogPhoenix.Repo couldn't be created, reason given: psql: FATAL: role "postgres" does not exist.
~/code/blog_phoenix:.
Run Code Online (Sandbox Code Playgroud) 我在Phoenix应用程序中遇到过时警告System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch。
事实是,我按照他们的文档中所述使用Rollbax:将Rollbax.report(:error, ArgumentError.exception("oops"), System.stacktrace())我正在执行的每个case语句包装在try / rescue块中感觉有点奇怪。例如这个:
case (SOME_URL |> HTTPoison.get([], [ ssl: [{:versions, [:'tlsv1.2']}] ])) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
Poison.decode!(body, [keys: :atoms])
{:ok, %HTTPoison.Response{status_code: 404}} ->
Rollbax.report(:error, :not_found, System.stacktrace(), %{reason: "Not found"})
{:ok, %HTTPoison.Response{status_code: 503}} ->
{:error, :ehostunreach}
{:error, …Run Code Online (Sandbox Code Playgroud)