diff --git a/unifi/unifi.go b/unifi/unifi.go index 41b7748..5e5f5d6 100644 --- a/unifi/unifi.go +++ b/unifi/unifi.go @@ -44,6 +44,16 @@ func (err *APIError) Error() string { return err.Message } +func (err *APIError) Is(target error) bool { + var apiError *APIError + if errors.As(target, &apiError) { + if err.RC == apiError.RC && err.Message == apiError.Message { + return true + } + } + return false +} + type Client struct { // single thread client calls for CSRF, etc. sync.Mutex