Skip to content

Commit

Permalink
Do not raise while handling exception in format_doc_arg (#291)
Browse files Browse the repository at this point in the history
Previously, an issue with the interpolation of the raised exception caused
format_doc_arg to raise an unrelated error.
  • Loading branch information
aj-foster committed Mar 8, 2024
1 parent 90f3cf4 commit a183ca3
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/elixir_sense/core/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1535,17 +1535,27 @@ defmodule ElixirSense.Core.State do
end

other ->
Logger.warning(
"Unable to format docstring expression #{inspect(quoted)}: eval resulted in #{inspect(other)}"
)
Logger.warning("""
Unable to format docstring expression:
#{inspect(quoted, pretty: true)}
Eval resulted in:
#{inspect(other)}
""")

""
end
rescue
e ->
Logger.warning(
"Unable to format docstring expression #{inspect(quoted)}: #{Exception.blame(:error, e, __STACKTRACE__)}"
)
Logger.warning("""
Unable to format docstring expression:
#{inspect(quoted, pretty: true)}
#{Exception.format(:error, e, __STACKTRACE__)}
""")

""
end
Expand Down

0 comments on commit a183ca3

Please sign in to comment.