From 209eead3d0eff49bd49cad5dbafc2fb79aba0eca Mon Sep 17 00:00:00 2001 From: Jonathan Lehman Date: Thu, 25 May 2017 15:12:23 -0400 Subject: [PATCH] Improve error messaging --- lib/slugbuilder/builder.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/slugbuilder/builder.rb b/lib/slugbuilder/builder.rb index 77df098..1ada705 100644 --- a/lib/slugbuilder/builder.rb +++ b/lib/slugbuilder/builder.rb @@ -211,7 +211,10 @@ def fetch_buildpacks def run_hook(hook_name) Dir.chdir(@build_dir) do script = "#{@build_dir}/bin/#{hook_name}" - run(script) if File.exists?(script) + if File.exists?(script) + rc = run(script) + fail "Failed to run #{script}" if rc != 0 + end end end @@ -246,7 +249,7 @@ def release(buildpack) end release_file.close - fail "Couldn't compile application using buildpack #{buildpack}" if rc != 0 + fail "Couldn't release application using buildpack #{buildpack}" if rc != 0 end def build_slug @@ -282,6 +285,7 @@ def parse_git_url(url) def normalize_git_url(url) matches = parse_git_url(url) + fail "Invalid buildpack url: #{url}." unless matches if Slugbuilder.config.protocol == 'ssh' "git@#{matches[:host] || Slugbuilder.config.git_service}:#{matches[:org]}/#{matches[:name]}.git" else