小编fhd*_*sni的帖子

无法混合ecto.create,角色'postgres'不存在

我尝试创建一个名为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)

postgresql elixir ecto phoenix-framework

14
推荐指数
1
解决办法
2720
查看次数

如何在case语句或控制器中使用__STACKTRACE__

我在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)

elixir phoenix-framework rollbar

6
推荐指数
1
解决办法
131
查看次数

标签 统计

elixir ×2

phoenix-framework ×2

ecto ×1

postgresql ×1

rollbar ×1