Client.CreateUpload returns a ErrUnexpectedResponse in the default case:
|
default: |
|
err = ErrUnexpectedResponse |
ErrUnexpectedResponse is a TusError, with TusError.Error() defined as:
|
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.
Client.CreateUploadreturns aErrUnexpectedResponsein the default case:tus-go-client/client.go
Lines 217 to 218 in 5a12337
ErrUnexpectedResponseis a TusError, withTusError.Error()defined as:tus-go-client/error.go
Lines 16 to 18 in 5a12337
So when
Error()is called onErrUnexpectedResponse, it returns a string with invalid formatting because the inner error is unset:I'm assuming this is easily fixed by setting
err = ErrUnexpectedResponse.WithResponse(response)in client.go.Note that ideally
TusError.WithResponseshould also not panic in case the error returned byio.ReadFullisn'tio.EOF, this is unexpected and undocumented, a better solution might be to sette.inner = err.