forked from phuslu/fastimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
41 lines (33 loc) · 824 Bytes
/
errors.go
File metadata and controls
41 lines (33 loc) · 824 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
package fastimage
import (
"fmt"
"io"
"time"
)
type HTTPStatusError struct {
URL string
StatusCode int
Status string
}
func (e *HTTPStatusError) Error() string {
return fmt.Sprintf("fastimage: unexpected HTTP status %s", e.Status)
}
type RetryAfterError struct {
URL string
StatusCode int
Status string
RetryAfter time.Duration
}
func (e *RetryAfterError) Error() string {
return fmt.Sprintf("fastimage: retry after %s", e.Status)
}
type InsufficientBytesError struct {
URL string
Got int
Min int
}
func (e *InsufficientBytesError) Error() string {
return fmt.Sprintf("fastimage: insufficient bytes: got %d, need at least %d", e.Got, e.Min)
}
// Let callers use errors.Is(err, io.ErrUnexpectedEOF).
func (e *InsufficientBytesError) Unwrap() error { return io.ErrUnexpectedEOF }