diff --git a/errors.go b/errors.go index 85fdc3efacb3..93faab0dbd62 100644 --- a/errors.go +++ b/errors.go @@ -152,6 +152,10 @@ func (e RequestError) Type() ErrorType { return e.cloudflareError.Type } +func (e RequestError) Unwrap() error { + return e.cloudflareError +} + func NewRequestError(e *Error) RequestError { return RequestError{ cloudflareError: e, @@ -192,6 +196,10 @@ func (e RatelimitError) Type() ErrorType { return e.cloudflareError.Type } +func (e RatelimitError) Unwrap() error { + return e.cloudflareError +} + func NewRatelimitError(e *Error) RatelimitError { return RatelimitError{ cloudflareError: e, @@ -231,6 +239,10 @@ func (e ServiceError) Type() ErrorType { return e.cloudflareError.Type } +func (e ServiceError) Unwrap() error { + return e.cloudflareError +} + func NewServiceError(e *Error) ServiceError { return ServiceError{ cloudflareError: e, @@ -270,6 +282,10 @@ func (e AuthenticationError) Type() ErrorType { return e.cloudflareError.Type } +func (e AuthenticationError) Unwrap() error { + return e.cloudflareError +} + func NewAuthenticationError(e *Error) AuthenticationError { return AuthenticationError{ cloudflareError: e, @@ -309,6 +325,10 @@ func (e AuthorizationError) Type() ErrorType { return e.cloudflareError.Type } +func (e AuthorizationError) Unwrap() error { + return e.cloudflareError +} + func NewAuthorizationError(e *Error) AuthorizationError { return AuthorizationError{ cloudflareError: e, @@ -348,6 +368,10 @@ func (e NotFoundError) Type() ErrorType { return e.cloudflareError.Type } +func (e NotFoundError) Unwrap() error { + return e.cloudflareError +} + func NewNotFoundError(e *Error) NotFoundError { return NotFoundError{ cloudflareError: e,