Hi all,

I was trying to log an exception and noticed that this does not work: 
Logger.error(exception). Logger could handle this case itself, but I think 
it would be better to handle it more generically.

So, I propose when a module uses the defexception macro, that Elixir 
automatically define the String.Chars implementation for that module. 
Inside the defexception macro, the implementation of String.Chars would be 
the following:

defimpl String.Chars, for: env.module do
  def to_string(error), do: Exception.format(:error, error)
end

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/88a99607-d4ea-472c-bd1a-48dee887f5e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to