forked from eventials/go-tus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
29 lines (25 loc) · 895 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package tus
import (
"errors"
"fmt"
)
var (
ErrChuckSize = errors.New("chunk size must be greater than zero.")
ErrNilLogger = errors.New("logger can't be nil.")
ErrNilStore = errors.New("store can't be nil if Resume is enable.")
ErrNilUpload = errors.New("upload can't be nil.")
ErrLargeUpload = errors.New("upload body is to large.")
ErrVersionMismatch = errors.New("protocol version mismatch.")
ErrOffsetMismatch = errors.New("upload offset mismatch.")
ErrUploadNotFound = errors.New("upload not found.")
ErrResumeNotEnabled = errors.New("resuming not enabled.")
ErrFingerprintNotSet = errors.New("fingerprint not set.")
ErrUrlNotRecognized = errors.New("url not recognized")
)
type ClientError struct {
Code int
Body []byte
}
func (c ClientError) Error() string {
return fmt.Sprintf("unexpected status code: %d", c.Code)
}