Improve error reporting, to help debug issues

Improve error reporting, to help debug issues

From 60c21c7d301e805a389087e5267314ce263c9736 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Tue, 27 Nov 2018 19:16:01 +1100
Subject: [PATCH] Improve error reporting, to help debug issues


diff --git a/lib/discourse_code_review/github_repo.rb b/lib/discourse_code_review/github_repo.rb
index 027e2c0..e57561f 100644
--- a/lib/discourse_code_review/github_repo.rb
+++ b/lib/discourse_code_review/github_repo.rb
@@ -141,7 +141,7 @@ module DiscourseCodeReview
       if !File.exist?(path)
         `git clone https://github.com/#{@name}.git '#{path}'`
         if $?.exitstatus != 0
-          raise ApplicationError, "Failed to clone repo #{@name} in tmp/code-review-repo"
+          raise StandardError, "Failed to clone repo #{@name} in tmp/code-review-repo"
         end
       end
 
@@ -153,7 +153,8 @@ module DiscourseCodeReview
           end
 
           if $?.exitstatus != 0
-            raise ApplicationError, "Failed to run git command #{command} on #{@name} in tmp/code-review-repo"
+            Rails.logger.warn("Discourse Code Review: Failed to run `#{command}` in #{path} error code: #{$?}")
+            raise StandardError, "Failed to run git command #{command} on #{@name} in tmp/code-review-repo"
           end
         end
         result

GitHub

1 Like