Skip to content

Commit

Permalink
Build Error includes first line of backtrace
Browse files Browse the repository at this point in the history
[rails/web-console] is meant to display Ruby errors.

When presented with JS stack traces, or free text CLI error messages, it
confusingly displays a large (almost to the fold) white console box.

To make it more obvious what the client-side error was, we include the
first line of the backtrace in the `BuildError`'s message.

[rails/web-console]: https://github.com/rails/web-console
  • Loading branch information
seanpdoyle committed Nov 12, 2015
1 parent aaa3ac1 commit cc46975
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/ember-cli/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ def build_error?
end

def raise_build_error!
error = BuildError.new("EmberCLI app #{name.inspect} has failed to build")
error.set_backtrace build_error_file_path.readlines
backtrace = build_error_file_path.readlines.reject(&:blank?)
message = "#{name.inspect} has failed to build: #{backtrace.first}"

error = BuildError.new(message)
error.set_backtrace(backtrace)

fail error
end

Expand Down

0 comments on commit cc46975

Please sign in to comment.