Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vintikzzz committed Oct 7, 2024
1 parent 2551800 commit d37ea78
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/services/web_seeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (s *WebSeeder) renderTorrent(w http.ResponseWriter, h string) {
t, err := s.tm.Get(h)

if err != nil {
log.Error(err)
http.Error(w, "failed to get torrent", http.StatusInternalServerError)
return
}
Expand Down Expand Up @@ -79,6 +80,7 @@ func (s *WebSeeder) renderTorrentIndex(w http.ResponseWriter, r *http.Request, h
t, err := s.tm.Get(h)

if err != nil {
log.Error(err)
http.Error(w, "failed to get torrent", http.StatusInternalServerError)
return
}
Expand Down Expand Up @@ -111,6 +113,7 @@ func (s *WebSeeder) serveFile(w http.ResponseWriter, r *http.Request, h string,
t, err := s.tm.Get(h)

if err != nil {
log.Error(err)
http.Error(w, "failed to get torrent", http.StatusInternalServerError)
return
}
Expand Down Expand Up @@ -159,6 +162,7 @@ func (s *WebSeeder) serveFile(w http.ResponseWriter, r *http.Request, h string,
func (s *WebSeeder) serveStats(w http.ResponseWriter, r *http.Request, h string, p string) {
err := s.st.Serve(w, r, h, p)
if err != nil {
log.Error(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
Expand All @@ -182,6 +186,7 @@ func (s *WebSeeder) getHash(r *http.Request) string {
func (s *WebSeeder) renderIndex(w http.ResponseWriter, r *http.Request) {
l, err := s.tm.List()
if err != nil {
log.Error(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
Expand Down

0 comments on commit d37ea78

Please sign in to comment.