-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
30 lines (24 loc) · 752 Bytes
/
errors.go
File metadata and controls
30 lines (24 loc) · 752 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
package marshal
import (
"errors"
"fmt"
)
var ErrNilHTTPClient = errors.New("nil http client error")
// HTTPError represents an error that occurred during an HTTP request.
type HTTPError struct {
StatusCode int
Body []byte
}
// Error implements the error interface for HTTPError.
func (e *HTTPError) Error() string {
return fmt.Sprintf("error in HTTP Response with StatusCode=%d and Body:\n%s", e.StatusCode, string(e.Body))
}
// DecodingError represents an error that occurred during JSON decoding.
type DecodingError struct {
RawJson []byte
RawErr error
}
// Error implements the error interface for DecodingError.
func (e *DecodingError) Error() string {
return fmt.Sprintf("error decoding %s, msg:\n%s", e.RawErr, e.RawJson)
}