Report the whole build failure, not just its first line for classic (non-Vite) blueprint - #678
Merged
Merged
Conversation
tricknotes
force-pushed
the
report-whole-build-failure
branch
from
September 11, 2026 07:18
996cb26 to
153ca46
Compare
`EmberCli::BuildError` was raised with `build_errors.first`, so everything the build tool wrote after the first line was dropped. The line naming the file that failed to build is rarely that first line — a Handlebars parse error, for instance, leads with `Build failed.` and names the file on the next line — which left the error reporting a line number with no file to look it up in. Join the failure's lines into the message instead, and set the same lines as the error's backtrace. The existing filtering is unchanged, so blank lines, JavaScript stack frames, deprecation warnings and `Building` notices still never reach the message; `build_errors` now chomps the lines it keeps, so a failure read from disk no longer carries the file's newlines into the message. This reporting is reached by the classic (non-Vite) blueprint only. There, `ember build --watch` runs in the background with its standard error redirected to the build error file, and `BuildMonitor` is what turns that file into an exception. An application built with the Vite blueprint goes through `Shell#compile` instead, where a failure is raised by `Runner#run!` as "`<command>` failed with status N" before `BuildMonitor` is consulted, and `rake ember:compile` takes that same path for every blueprint. Neither of those is changed here. Closes #484 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tricknotes
force-pushed
the
report-whole-build-failure
branch
from
September 11, 2026 12:08
153ca46 to
777d5b2
Compare
tricknotes
marked this pull request as ready for review
September 11, 2026 12:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #484.
EmberCli::BuildErrorwas raised withbuild_errors.first, so everything the build tool wrote after the first line was dropped. The line naming the file that failed to build is rarely that first line — a Handlebars parse error leads withBuild failed.and names the file on the next line — which left the error reporting a line number with no file to look it up in, exactly as #484 reports.Scope: the classic blueprint only
BuildMonitoris reached by the classic (non-Vite) blueprint only, so that is the only case this changes.development(ember build --watchin the background, standard error redirected to the build error file)BuildMonitorturns the error file intoEmberCli::BuildErrordevelopmentShell#compile—rake ember:compile,assets:precompile, and thedevelopment/testbuild of a Vite applicationRunner#run!raises`<command>` failed with status NbeforeBuildMonitoris consultedReporting the failure on the
Shell#compilepath is a separate concern and is left for its own change.Approach
Report the whole filtered failure rather than parsing out the file name.
File: x,in xandBuild Error (...) in xare all used across build tools and versions, and matching them is fragile — a concern already raised in #318. Joining the lines surfaces the file wherever the tool happens to put it.The existing filtering is untouched, so blank lines, JavaScript stack frames (
at ...),DEPRECATION:warnings andBuildingnotices still never reach the message.build_errorsnow chomps the lines it keeps, so a failure read from disk no longer carries the file's newlines into the message.Before / after
Verified end to end against a classic application (
ember-cli5.12.0,ember newblueprint) whoseapp/templates/application.hbsis missing a{{/if}}, served indevelopmentso that theember build --watchpath runs:Before:
After:
The file, the line, the offending source and the caret all survive now; the
at ...frames are still filtered out.Tests
Three examples added to
spec/lib/ember_cli/build_monitor_spec.rb: the multi-line report, the backtrace contents, and that lines read from disk do not carry their trailing newlines. No existing example needed changing.bin/rspec spec/lib/ember_cli/build_monitor_spec.rb— 13 examples, 0 failuresbin/rspec spec/lib— 166 examples, 2 failures. Both (app_spec.rb:192,app_spec.rb:200) fail identically with this branch stashed; they neednode_modulesinstalled to find theemberbinary.Open questions for review
set_backtrace(errors)is a straight generalisation of the oldset_backtrace(build_errors.first), but it now duplicates the message. Setting the backtrace to theat ...frames the filter discards would be more faithful to what a backtrace is — left out here as a larger behaviour change.ember-cliwrote its error block to standard error twice, and both copies reach the message. Truncating to the first N lines is an option.CHANGELOG.mdgains a newmainsection, since0.14.0is released.🤖 Generated with Claude Code