-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Client.CreateUpload returns a ErrUnexpectedResponse in the default case:
Lines 217 to 218 in 5a12337
| default: | |
| err = ErrUnexpectedResponse |
ErrUnexpectedResponse is a TusError, with TusError.Error() defined as:
Lines 16 to 18 in 5a12337
| func (te TusError) Error() string { | |
| return fmt.Sprintf("%s: %s", te.msg, te.inner) | |
| } |
So when Error() is called on ErrUnexpectedResponse, it returns a string with invalid formatting because the inner error is unset:
unexpected HTTP response code: %!s(<nil>)
I'm assuming this is easily fixed by setting err = ErrUnexpectedResponse.WithResponse(response) in client.go.
Note that ideally TusError.WithResponse should also not panic in case the error returned by io.ReadFull isn't io.EOF, this is unexpected and undocumented, a better solution might be to set te.inner = err.
Metadata
Metadata
Assignees
Labels
No labels