Fix error comparisons

This commit is contained in:
Deluan
2022-09-30 18:54:25 -04:00
parent 7b0a8f47de
commit db67c1277e
27 changed files with 93 additions and 73 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ package subsonic
import (
"encoding/json"
"encoding/xml"
"errors"
"fmt"
"net/http"
"runtime"
@@ -183,7 +184,7 @@ func h(r chi.Router, path string, f handler) {
if err != nil {
// If it is not a Subsonic error, convert it to an ErrorGeneric
if _, ok := err.(subError); !ok {
if err == model.ErrNotFound {
if errors.Is(err, model.ErrNotFound) {
err = newError(responses.ErrorDataNotFound, "data not found")
} else {
err = newError(responses.ErrorGeneric, "Internal Error")