Browse Source

Gracefully handle bblfsh server's absence

Fixes #193
Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
Vadim Markovtsev 6 years ago
parent
commit
b232afd03f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      internal/plumbing/uast/uast.go

+ 6 - 1
internal/plumbing/uast/uast.go

@@ -6,6 +6,7 @@ import (
 	"fmt"
 	"io"
 	"io/ioutil"
+	"log"
 	"os"
 	"path"
 	"runtime"
@@ -172,7 +173,11 @@ func (exr *Extractor) Initialize(repository *git.Repository) error {
 	for i := 0; i < poolSize; i++ {
 		client, err := bblfsh.NewClient(exr.Endpoint)
 		if err != nil {
-			panic(err)
+			if err.Error() == "context deadline exceeded" {
+				log.Println("Looks like the Babelfish server is not running. Please refer " +
+					"to https://docs.sourced.tech/babelfish/using-babelfish/getting-started#running-with-docker-recommended")
+			}
+			return err
 		}
 		exr.clients[i] = client
 	}