bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.96k stars 398 forks source link

Consistent error message (incl. stacktrace) when evaluation failed #579

Closed janpieper closed 5 years ago

janpieper commented 5 years ago

Summary of changes

We had a problem when deploying a service because it failed running a command. The only error we got was:

▸ Evaluation failed with: argument error

We did not know what is causing the error and where it is coming from, so we were forced to monkey-patch distillery to get more details. We've updated the rescue-block in Mix.Releases.Runtime.Control.eval/2 to give us the error messages and the stacktrace. After doing so, we got this.

▸  Evaluation failed: argument error
▸      (stdlib) :ets.insert(:otter_snapshot_store, {...}]})
▸      (otter_lib) /src/deps/otter_lib/src/otter_lib_snapshot_count.erl:59: :otter_lib_snapshot_count.snapshot/2
▸      (otter) /src/deps/otter/src/otter_filter.erl:60: :otter_filter.do_actions/5
▸      (tracing) lib/tracing/adapter/otter.ex:49: Tracing.Adapter.Otter.finish_span/1
▸      (tracing) lib/tracing.ex:93: Tracing.finish_span/2
▸      (tracing) lib/tracing/ecto/repo.ex:168: Tracing.Ecto.Repo.trace/3
▸      (stdlib) timer.erl:197: :timer.tc/3
▸      (ecto) lib/ecto/migration/runner.ex:25: Ecto.Migration.Runner.run/6

Yay! :tada: We forgot to start otter.

This PR updates Mix.Releases.Runtime.Control.eval/2 to have a consistent error message (incl. stacktrace).

Checklist

Licensing/Copyright

By submitting this PR, you agree to the following statement, please read before submission!

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for Distillery (the "Contribution"). My Contribution is licensed under the MIT License.

bitwalker commented 5 years ago

Thanks!