aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/ext/router.go2
-rw-r--r--pkg/service/git.go5
2 files changed, 7 insertions, 0 deletions
diff --git a/pkg/ext/router.go b/pkg/ext/router.go
index 956254d..e12a40c 100644
--- a/pkg/ext/router.go
+++ b/pkg/ext/router.go
@@ -3,6 +3,7 @@ package ext
import (
"errors"
"fmt"
+ "log/slog"
"net/http"
"git.gabrielgio.me/cerrado/pkg/service"
@@ -38,6 +39,7 @@ func wrapError(next ErrorRequestHandler) http.HandlerFunc {
if errors.Is(err, service.ErrRepositoryNotFound) {
NotFound(w, r)
} else {
+ slog.Error("Internal Server Error", "error", err)
InternalServerError(r, w, err)
}
}
diff --git a/pkg/service/git.go b/pkg/service/git.go
index afe6103..12d238e 100644
--- a/pkg/service/git.go
+++ b/pkg/service/git.go
@@ -8,6 +8,7 @@ import (
"git.gabrielgio.me/cerrado/pkg/config"
"git.gabrielgio.me/cerrado/pkg/git"
+ gogit "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
)
@@ -49,6 +50,10 @@ func (g *GitService) ListRepositories() ([]*Repository, error) {
for _, r := range rs {
repo, err := git.OpenRepository(r.Path)
if err != nil {
+ if errors.Is(err, gogit.ErrRepositoryNotExists) {
+ slog.Info("Path does not contain a repository", "path", r.Path)
+ continue
+ }
return nil, err
}