Skip to content

Commit

Permalink
Print debug: true if layer stacktrace is missing, see #475
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 12, 2023
1 parent cd37a8a commit f1b10fa
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions lib/axon/compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,29 @@ defmodule Axon.CompileError do
formatted_mfa = Exception.format_mfa(module, fun, arity)
formatted_msg = Exception.format(:error, exception.exception, exception.compile_stacktrace)

layer_info =
if exception.layer_stacktrace != [] do
"""
The layer was defined at:
#{Exception.format_stacktrace(exception.layer_stacktrace)}
"""
else
"""
(pass debug: true to build/compile see where the layer was defined)
"""
end

"""
exception found when compiling layer #{formatted_mfa} named #{exception.name}:
#{indent(formatted_msg)}
The layer was defined at:
#{indent(formatted_msg)}\
#{layer_info}\
#{Exception.format_stacktrace(exception.layer_stacktrace)}
Compiling of the model was initiated at:
"""
end
Expand Down

0 comments on commit f1b10fa

Please sign in to comment.