Expose errors to users during build rather than burying them in output files.

This commit is contained in:
Ben Hollis 2012-03-17 16:41:27 -07:00
parent d36077f47b
commit 6f4e863091

View file

@ -35,8 +35,7 @@ module Middleman::Cli
# @return [void] # @return [void]
def build def build
if !ENV["MM_ROOT"] if !ENV["MM_ROOT"]
$stderr.puts "== Error: Could not find a Middleman project config, perhaps you are in the wrong folder?" raise Thor::Error "Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
exit(1)
end end
self.class.shared_instance(options["verbose"] || false) self.class.shared_instance(options["verbose"] || false)
@ -103,11 +102,14 @@ module Middleman::Cli
begin begin
response = self.class.shared_rack.get(page.request_path.gsub(/\s/, "%20")) response = self.class.shared_rack.get(page.request_path.gsub(/\s/, "%20"))
if response.status == 200
create_file(output_file, response.body, { :force => true }) create_file(output_file, response.body, { :force => true })
else
raise Thor::Error.new response.body
end
rescue rescue
say_status :error, output_file, :red say_status :error, output_file, :red
puts $! raise Thor::Error.new $!
abort
end end
end end
end end