mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 11:13:26 +00:00
fix: improve error handling for guest URL saving (addresses #427)
- Add more specific error messages when metadata save fails - Better handling of permission and disk space errors - This should help diagnose why guest URLs fail to save in some cases - The atomic write operation was already in place but errors weren't clear
This commit is contained in:
@@ -99,7 +99,14 @@ func (h *GuestMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *ht
|
||||
|
||||
if err := h.store.Set(guestID, &meta); err != nil {
|
||||
log.Error().Err(err).Str("guestID", guestID).Msg("Failed to save guest metadata")
|
||||
http.Error(w, "Failed to save metadata", http.StatusInternalServerError)
|
||||
// Provide more specific error message
|
||||
errMsg := "Failed to save metadata"
|
||||
if strings.Contains(err.Error(), "permission") {
|
||||
errMsg = "Permission denied - check file permissions"
|
||||
} else if strings.Contains(err.Error(), "no space") {
|
||||
errMsg = "Disk full - cannot save metadata"
|
||||
}
|
||||
http.Error(w, errMsg, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user