Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw if templating a file fails #3786

Merged
merged 2 commits into from May 20, 2015

Conversation

davewasmer
Copy link
Contributor

Previously, if an error was thrown during the template rendering process, the error was simply swallowed. This was likely to avoid errors when attempting to template a binary file, since the byte stream, when converted to a string, could contain template markers.

Adds the isbinaryfile package to detect if the file is binary. If so, it skips templating entirely. If not, it attempts to template the file, and allows exceptions to reject the render promise.

This happened to expose some tests that should have been failing around the http-proxy generators (the tests were not supplying enough arguments). Fixes those tests too.

@quantuminformation
Copy link
Contributor

I'm going through the upgrade steps for my test-recorder then will link to this branch from my npm and run ember init again.

@stefanpenner stefanpenner added this to the v0.2.3 milestone Apr 4, 2015
@stefanpenner stefanpenner self-assigned this Apr 4, 2015
return content.toString();
}
return lstat(path).then(function(fileStat) {
if (isBinaryFile(content, fileStat.size)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should ad a test for binary files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stefanpenner
Copy link
Contributor

needs rebase

@stefanpenner stefanpenner modified the milestones: v0.2.4, v0.2.3 Apr 6, 2015
Previously, if an error was thrown during the template rendering
process, the error was simply swallowed. This was likely to avoid
errors when attempting to template a binary file, since the byte
stream, when converted to a string, could contain template markers.

Adds the isbinaryfile package to detect if the file is binary. If
so, it skips templating entirely. If not, it attempts to template
the file, and allows exceptions to reject the render promise.

This happened to expose some tests that should have been failing
around the http-proxy generators (the tests were not supplying
enough arguments). Fixes those tests too.
@davewasmer
Copy link
Contributor Author

Rebased and addressed all the outstanding comments @stefanpenner

@stefanpenner
Copy link
Contributor

kicking appveyor

stefanpenner added a commit that referenced this pull request May 20, 2015
@stefanpenner stefanpenner merged commit 2ae30da into ember-cli:master May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants