Add req.Params to replace utils.Param*

This commit is contained in:
Deluan
2023-12-21 16:32:37 -05:00
parent 965fc9d9be
commit 00597e01e9
5 changed files with 393 additions and 39 deletions
+8
View File
@@ -2,6 +2,7 @@ package subsonic
import (
"context"
"errors"
"fmt"
"mime"
"net/http"
@@ -62,6 +63,13 @@ func newError(code int, message ...interface{}) error {
}
}
// errSubsonic and Unwrap are used to allow `errors.Is(err, errSubsonic)` to work
var errSubsonic = errors.New("subsonic API error")
func (e subError) Unwrap() error {
return fmt.Errorf("%w: %d", errSubsonic, e.code)
}
func (e subError) Error() string {
var msg string
if len(e.messages) == 0 {