Permalink
Browse files

Added Error Handling when no more commits are available

  • Loading branch information...
1 parent 0f686be commit 0ea9d0dfad1c85953e289efc253eb76e4eab9c7b @lukx lukx committed Sep 13, 2013
Showing with 14 additions and 1 deletion.
  1. +13 −0 src/GitList/Controller/NetworkController.php
  2. +1 −1 web/js/networkGraph.js
@@ -55,6 +55,7 @@ function ($repo, $commitishPath, $page) use ($app) {
}
$nextPageUrl = null;
+
if ($pager['last'] !== $pager['current']) {
$nextPageUrl = $app['url_generator']->generate(
'networkData',
@@ -65,6 +66,18 @@ function ($repo, $commitishPath, $page) use ($app) {
)
);
}
+
+ // when no commits are given, return an empty response - issue #369
+ if( count($commits) === 0 ) {
+ return $app->json( array(
+ 'repo' => $repo,
+ 'commitishPath' => $commitishPath,
+ 'nextPage' => null,
+ 'start' => null,
+ 'commits' => $jsonFormattedCommits
+ ), 200
+ );
+ }
return $app->json( array(
'repo' => $repo,
View
@@ -351,7 +351,7 @@
}
function handleNoAvailableData() {
- console.log('No Data available');
+ window.console && console.log('No (more) Data available');
}
var awaitedParents = {};

0 comments on commit 0ea9d0d

Please sign in to comment.