Skip to content

Fix compilation error when specific adapter is not included#64

Merged
mgiacomini merged 2 commits intoateliware:masterfrom
vanetix:fix/remove-adapter-structs
Mar 7, 2019
Merged

Fix compilation error when specific adapter is not included#64
mgiacomini merged 2 commits intoateliware:masterfrom
vanetix:fix/remove-adapter-structs

Conversation

@vanetix
Copy link
Copy Markdown
Contributor

@vanetix vanetix commented Mar 5, 2019

I was getting an error when compiling a dependent project that only has postgrex as a dependency, due to the error struct pattern matching. I removed this logic in favor of Exception.message/1.

  • Fixed compilation error when optional adapters are not included in downstream project.
  • Added docker-compose configuration that allows easy setup for test databases.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.002%) to 99.505% when pulling f4db93c on vanetix:fix/remove-adapter-structs into 3f768a1 on ateliware:master.

environment:
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, cool! Forgot I was using docker at some point! Thanks for this!

defp error_message(%MXError{} = e), do: MXError.message(e)
defp error_message(msg), do: msg
defp error_message(msg) do
if Exception.exception?(msg) do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks perfect! Unfortunately they don't have a defguard for it on elixir, it would be a lot more idiomatic if you could use when Exception.exception?(msg) on a guard, but it's not possible as it is now. I'll open a PR to Elixir core and check if they accept it though.

@kelvinst
Copy link
Copy Markdown
Contributor

kelvinst commented Mar 7, 2019

PS.: the coverage went down because the overall line quantity went down. So we can merge and release a new rc for it.

@kelvinst
Copy link
Copy Markdown
Contributor

kelvinst commented Mar 7, 2019

This fixes #65

@mgiacomini mgiacomini merged commit c8b3ee2 into ateliware:master Mar 7, 2019
@vanetix vanetix deleted the fix/remove-adapter-structs branch March 8, 2019 17:50
@vanetix
Copy link
Copy Markdown
Contributor Author

vanetix commented Mar 8, 2019

Just wanted to say thanks for all the work on Triplex! Its made my life much easier. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants