summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index e8f2d41..f41d184 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -311,7 +311,8 @@ func qrHandler(w http.ResponseWriter, r *http.Request) {
}
qr, err := qrcode.Encode(text, qrcode.Medium, 200)
if err != nil {
- http.Error(w, fmt.Sprintf("failed to encode QR code: %s", err), http.StatusInternalServerError)
+ log.Printf("Error: failed to encode QR code: %s", err)
+ http.Error(w, "Failed to encode QR code", http.StatusInternalServerError)
return
}
http.ServeContent(w, r, "qr.png", time.Time{}, bytes.NewReader(qr))
@@ -554,7 +555,7 @@ func wormholeUpload(w http.ResponseWriter, r *http.Request) {
}
return
}
- log.Printf("Warning: failed to upload hole file: %s", err)
+ log.Printf("Error: failed to upload hole file: %s", err)
http.Error(w, "Internal error", http.StatusInternalServerError)
return
}
@@ -585,7 +586,7 @@ func writeSingleHoleFile(filename string, r io.Reader) (string, error) {
func wormholeAPIUpload(w http.ResponseWriter, r *http.Request) {
hole, err := writeSingleHoleFile(r.PathValue("name"), r.Body)
if err != nil {
- log.Printf("Failed to write hole file: %s", err)
+ log.Printf("Error: failed to write hole file: %s", err)
http.Error(w, "Failed to write hole file", http.StatusInternalServerError)
return
}
@@ -602,7 +603,8 @@ func wormholeDownload(w http.ResponseWriter, r *http.Request) {
notFound(w, r)
return
}
- log.Printf("Warning: read hole file: %s", err)
+ log.Printf("Error: failed to read hole file: %s", err)
+ http.Error(w, "Failed to read hole file", http.StatusInternalServerError)
return
}
}
@@ -620,14 +622,14 @@ func cleanHole() error {
for _, file := range files {
stat, err := file.Info()
if err != nil {
- log.Printf("Warning: clean hole: %s", err)
+ log.Printf("Error: clean hole: %s", err)
continue
}
if !stat.ModTime().Before(deadline) {
continue
}
if err := os.Remove(*holeTempDir + "/" + file.Name()); err != nil {
- log.Printf("Warning: clean hole: %s", err)
+ log.Printf("Error: clean hole: %s", err)
continue
}
}
@@ -920,7 +922,8 @@ func autosave(w http.ResponseWriter, r *http.Request) {
func cmd(w http.ResponseWriter, r *http.Request) {
serviceConfig, err := loadConfig()
if err != nil {
- http.Error(w, fmt.Sprintf("load config: %s", err), http.StatusInternalServerError)
+ log.Printf("Error: failed to load config: %s", err)
+ http.Error(w, "Failed to load config", http.StatusInternalServerError)
return
}
sourceIdx, ok := slices.BinarySearchFunc(serviceConfig.CommandRedirects, r.PathValue("cmd"), func(cmd commandConfig, name string) int { return strings.Compare(cmd.Name, name) })
@@ -948,7 +951,7 @@ type pkgIndexTemplateArgs struct {
func pkgIndex(w http.ResponseWriter, r *http.Request) {
serviceConfig, err := loadConfig()
if err != nil {
- log.Printf("Warning: failed to load config: %s", err)
+ log.Printf("Error: failed to load config: %s", err)
http.Error(w, "Failed to load config", http.StatusInternalServerError)
return
}
@@ -970,7 +973,7 @@ type cmdIndexTemplateArgs struct {
func cmdIndex(w http.ResponseWriter, r *http.Request) {
serviceConfig, err := loadConfig()
if err != nil {
- log.Printf("Warning: failed to load config: %s", err)
+ log.Printf("Error: failed to load config: %s", err)
http.Error(w, "Failed to load config", http.StatusInternalServerError)
return
}
@@ -982,7 +985,7 @@ func cmdIndex(w http.ResponseWriter, r *http.Request) {
func pkg(w http.ResponseWriter, r *http.Request) {
serviceConfig, err := loadConfig()
if err != nil {
- log.Printf("Warning: failed to load config: %s", err)
+ log.Printf("Error: failed to load config: %s", err)
http.Error(w, "Failed to load config", http.StatusInternalServerError)
return
}
@@ -1149,7 +1152,7 @@ func main() {
go func() {
for range time.NewTicker(2 * time.Hour).C {
if err := cleanHole(); err != nil {
- log.Printf("Warning: clean hole: %s", err)
+ log.Printf("Error: clean hole: %s", err)
}
}
}()