🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Change error code type to avoid integer overflow conversion warning
Deluanfc5d18feb793
diff --git a/server/subsonic/api.go b/server/subsonic/api.goindex bebe5d6e1..6fb747d2c 100644--- a/server/subsonic/api.go+++ b/server/subsonic/api.go@@ -281,7 +281,7 @@ func sendError(w http.ResponseWriter, r *http.Request, err error) {subErr := mapToSubsonicError(err)response := newResponse()response.Status = responses.StatusFailed- response.Error = &responses.Error{Code: int32(subErr.code), Message: subErr.Error()}+ response.Error = &responses.Error{Code: subErr.code, Message: subErr.Error()}sendResponse(w, r, response)}diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.goindex c5417d523..7afbbbfea 100644--- a/server/subsonic/helpers.go+++ b/server/subsonic/helpers.go@@ -28,11 +28,11 @@ func newResponse() *responses.Subsonic {}type subError struct {- code int+ code int32messages []interface{}}-func newError(code int, message ...interface{}) error {+func newError(code int32, message ...interface{}) error {return subError{code: code,messages: message,diff --git a/server/subsonic/responses/errors.go b/server/subsonic/responses/errors.goindex c15ccd92c..42e5427b3 100644--- a/server/subsonic/responses/errors.go+++ b/server/subsonic/responses/errors.go@@ -1,17 +1,17 @@package responsesconst (- ErrorGeneric = 0- ErrorMissingParameter = 10- ErrorClientTooOld = 20- ErrorServerTooOld = 30- ErrorAuthenticationFail = 40- ErrorAuthorizationFail = 50- ErrorTrialExpired = 60- ErrorDataNotFound = 70+ ErrorGeneric int32 = 0+ ErrorMissingParameter int32 = 10+ ErrorClientTooOld int32 = 20+ ErrorServerTooOld int32 = 30+ ErrorAuthenticationFail int32 = 40+ ErrorAuthorizationFail int32 = 50+ ErrorTrialExpired int32 = 60+ ErrorDataNotFound int32 = 70)-var errors = map[int]string{+var errors = map[int32]string{ErrorGeneric: "A generic error",ErrorMissingParameter: "Required parameter is missing",ErrorClientTooOld: "Incompatible Subsonic REST protocol version. Client must upgrade",@@ -22,7 +22,7 @@ var errors = map[int]string{ErrorDataNotFound: "The requested data was not found",}-func ErrorMsg(code int) string {+func ErrorMsg(code int32) string {if v, found := errors[code]; found {return v}