mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-09-07 15:07:17 +00:00
fix(stereo): simplify cleanup classification
This commit is contained in:
committed by
Tobias Gesellchen
parent
c8f0d9e580
commit
8e4520c292
@@ -385,9 +385,11 @@ func stereoPairHTTPStatus(result stereopair.Result) int {
|
||||
if resultHasStereoPairError(result, stereopair.ErrInvalidRequest) {
|
||||
return http.StatusBadRequest
|
||||
}
|
||||
|
||||
if resultHasStereoPairError(result, stereopair.ErrConflict) {
|
||||
return http.StatusConflict
|
||||
}
|
||||
|
||||
if result.Status == stereopair.StatusDegraded {
|
||||
return http.StatusBadGateway
|
||||
}
|
||||
|
||||
@@ -73,16 +73,26 @@ func DeleteMargeGroupGeneration(httpClient *http.Client, ref GenerationRef) erro
|
||||
return err
|
||||
}
|
||||
|
||||
if response.StatusCode == http.StatusInternalServerError && margeWrappedGroupNotFound(body, ref) {
|
||||
return handleMargeGenerationCleanupFailure(httpClient, ref, response.StatusCode, body)
|
||||
}
|
||||
|
||||
func handleMargeGenerationCleanupFailure(
|
||||
httpClient *http.Client,
|
||||
ref GenerationRef,
|
||||
statusCode int,
|
||||
body []byte,
|
||||
) error {
|
||||
if statusCode == http.StatusInternalServerError && margeWrappedGroupNotFound(body, ref) {
|
||||
return verifyMargeGroupGenerationDeleted(httpClient, ref)
|
||||
}
|
||||
if response.StatusCode == http.StatusConflict {
|
||||
|
||||
if statusCode == http.StatusConflict {
|
||||
return fmt.Errorf("%w: delete Marge group generation: HTTP %d: %s",
|
||||
ErrConflict, response.StatusCode, strings.TrimSpace(string(body)))
|
||||
ErrConflict, statusCode, strings.TrimSpace(string(body)))
|
||||
}
|
||||
|
||||
return fmt.Errorf("delete Marge group generation: HTTP %d: %s",
|
||||
response.StatusCode, strings.TrimSpace(string(body)))
|
||||
statusCode, strings.TrimSpace(string(body)))
|
||||
}
|
||||
|
||||
func readMargeGenerationCleanupResponse(response *http.Response) ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user