[Bps-public-commit] rt-extension-travisci branch, master, updated. bfdd2c1d01e5dd90482c9babb5fd95878c8482d7

? sunnavy sunnavy at bestpractical.com
Wed Aug 26 20:15:12 EDT 2020


The branch, master has been updated
       via  bfdd2c1d01e5dd90482c9babb5fd95878c8482d7 (commit)
      from  12572d7cc7b638932d80b51b904501fcf3b6f701 (commit)

Summary of changes:
 lib/RT/Extension/TravisCI.pm | 4 ++++
 1 file changed, 4 insertions(+)

- Log -----------------------------------------------------------------
commit bfdd2c1d01e5dd90482c9babb5fd95878c8482d7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Aug 27 06:36:56 2020 +0800

    Handle the case where the test build is not actually found in travis
    
    This could happen if the branch doesn't exist or was created before
    travis's integration.
    
    Note that travis doesn't return HTTP 404 for non-existing branches that
    have existing prefixes like 4.4/foobar
    
    Without this, JS would error out "Uncaught TypeError: Cannot read
    property 'replace' of undefined".

diff --git a/lib/RT/Extension/TravisCI.pm b/lib/RT/Extension/TravisCI.pm
index 61aae5a..f1cfe1d 100644
--- a/lib/RT/Extension/TravisCI.pm
+++ b/lib/RT/Extension/TravisCI.pm
@@ -102,6 +102,10 @@ sub get_status
         return { success => 0, error => 'Could not parse result as JSON' };
     }
 
+    if ( !$result->{last_build} ) {
+        return { success => 0, error => 'Not found' };
+    }
+
     # Format the dates according to user preference
     $result->{last_build}->{started_at}  = format_date($result->{last_build}->{started_at}, $current_user);
     $result->{last_build}->{finished_at} = format_date($result->{last_build}->{finished_at}, $current_user);

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list