2016-02-24 14:06:49 -09:00
|
|
|
package responses
|
|
|
|
|
|
|
|
|
|
const (
|
2024-09-01 10:41:21 -08:00
|
|
|
ErrorGeneric int32 = 0
|
|
|
|
|
ErrorMissingParameter int32 = 10
|
|
|
|
|
ErrorClientTooOld int32 = 20
|
|
|
|
|
ErrorServerTooOld int32 = 30
|
|
|
|
|
ErrorAuthenticationFail int32 = 40
|
|
|
|
|
ErrorAuthorizationFail int32 = 50
|
|
|
|
|
ErrorTrialExpired int32 = 60
|
|
|
|
|
ErrorDataNotFound int32 = 70
|
2016-02-24 14:06:49 -09:00
|
|
|
)
|
|
|
|
|
|
2024-09-01 10:41:21 -08:00
|
|
|
var errors = map[int32]string{
|
2020-01-08 06:25:23 -09:00
|
|
|
ErrorGeneric: "A generic error",
|
|
|
|
|
ErrorMissingParameter: "Required parameter is missing",
|
|
|
|
|
ErrorClientTooOld: "Incompatible Subsonic REST protocol version. Client must upgrade",
|
|
|
|
|
ErrorServerTooOld: "Incompatible Subsonic REST protocol version. Server must upgrade",
|
|
|
|
|
ErrorAuthenticationFail: "Wrong username or password",
|
|
|
|
|
ErrorAuthorizationFail: "User is not authorized for the given operation",
|
|
|
|
|
ErrorTrialExpired: "The trial period for the Subsonic server is over. Please upgrade to Subsonic Premium. Visit subsonic.org for details",
|
|
|
|
|
ErrorDataNotFound: "The requested data was not found",
|
2016-02-24 14:06:49 -09:00
|
|
|
}
|
|
|
|
|
|
2024-09-01 10:41:21 -08:00
|
|
|
func ErrorMsg(code int32) string {
|
2016-03-02 09:04:55 -09:00
|
|
|
if v, found := errors[code]; found {
|
|
|
|
|
return v
|
2016-03-01 08:35:30 -09:00
|
|
|
}
|
2016-03-23 08:35:10 -08:00
|
|
|
return errors[ErrorGeneric]
|
2016-02-25 14:52:07 -09:00
|
|
|
}
|