diff --git a/pkg/mining/errors.go b/pkg/mining/errors.go index 9eef3f9..ac9ecd7 100644 --- a/pkg/mining/errors.go +++ b/pkg/mining/errors.go @@ -24,7 +24,6 @@ const ( ErrCodeProfileNotFound = "PROFILE_NOT_FOUND" ErrCodeProfileExists = "PROFILE_EXISTS" ErrCodeInternalError = "INTERNAL_ERROR" - ErrCodeInternal = "INTERNAL_ERROR" // Alias for consistency ) // e := &MiningError{Code: ErrCodeStartFailed, Message: "failed to start xmrig", HTTPStatus: 500} diff --git a/pkg/mining/node_service.go b/pkg/mining/node_service.go index e1ae86a..cc294e1 100644 --- a/pkg/mining/node_service.go +++ b/pkg/mining/node_service.go @@ -275,7 +275,7 @@ func (ns *NodeService) handlePingPeer(c *gin.Context) { respondWithError(c, http.StatusNotFound, "PEER_NOT_FOUND", "peer not found or not connected", err.Error()) return } - respondWithError(c, http.StatusInternalServerError, ErrCodeInternal, "ping failed", err.Error()) + respondWithError(c, http.StatusInternalServerError, ErrCodeInternalError, "ping failed", err.Error()) return } c.JSON(http.StatusOK, gin.H{"rtt_ms": rtt}) @@ -319,7 +319,7 @@ func (ns *NodeService) handleDisconnectPeer(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"status": "disconnected"}) return } - respondWithError(c, http.StatusInternalServerError, ErrCodeInternal, "disconnect failed", err.Error()) + respondWithError(c, http.StatusInternalServerError, ErrCodeInternalError, "disconnect failed", err.Error()) return } c.JSON(http.StatusOK, gin.H{"status": "disconnected"}) diff --git a/pkg/mining/service.go b/pkg/mining/service.go index e1692cb..2e25476 100644 --- a/pkg/mining/service.go +++ b/pkg/mining/service.go @@ -1187,7 +1187,7 @@ func (s *Service) handleCreateProfile(c *gin.Context) { createdProfile, err := s.ProfileManager.CreateProfile(&profile) if err != nil { - respondWithError(c, http.StatusInternalServerError, ErrCodeInternal, "failed to create profile", err.Error()) + respondWithError(c, http.StatusInternalServerError, ErrCodeInternalError, "failed to create profile", err.Error()) return } @@ -1238,7 +1238,7 @@ func (s *Service) handleUpdateProfile(c *gin.Context) { respondWithError(c, http.StatusNotFound, ErrCodeProfileNotFound, "profile not found", err.Error()) return } - respondWithError(c, http.StatusInternalServerError, ErrCodeInternal, "failed to update profile", err.Error()) + respondWithError(c, http.StatusInternalServerError, ErrCodeInternalError, "failed to update profile", err.Error()) return } c.JSON(http.StatusOK, profile) @@ -1260,7 +1260,7 @@ func (s *Service) handleDeleteProfile(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"status": "profile deleted"}) return } - respondWithError(c, http.StatusInternalServerError, ErrCodeInternal, "failed to delete profile", err.Error()) + respondWithError(c, http.StatusInternalServerError, ErrCodeInternalError, "failed to delete profile", err.Error()) return } c.JSON(http.StatusOK, gin.H{"status": "profile deleted"})