diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-31 16:09:12 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-31 16:09:12 -0600 |
| commit | 238b61113456ebad8bad880913dc315cd892a296 (patch) | |
| tree | f38db8e10c4b55aef21c96c30fc71278c6e3d5c6 /vendor/github.com/playwright-community/playwright-go/errors.go | |
| parent | ebb003ef2beaeee61104d6b88a342c5c9fa73b51 (diff) | |
| parent | 311603d0c0b04d451e9fb8e5e8335dca8425e2c4 (diff) | |
Merge branch 'sparkle-visibility' into 'main'
Connect to postgresql
See merge request gitlab-org/software-supply-chain-security/authorization/sparkled!21
Diffstat (limited to 'vendor/github.com/playwright-community/playwright-go/errors.go')
| -rw-r--r-- | vendor/github.com/playwright-community/playwright-go/errors.go | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/vendor/github.com/playwright-community/playwright-go/errors.go b/vendor/github.com/playwright-community/playwright-go/errors.go deleted file mode 100644 index 36f7396..0000000 --- a/vendor/github.com/playwright-community/playwright-go/errors.go +++ /dev/null @@ -1,58 +0,0 @@ -package playwright - -import ( - "errors" - "fmt" -) - -var ( - // ErrPlaywright wraps all Playwright errors. - // - Use errors.Is to check if the error is a Playwright error. - // - Use errors.As to cast an error to [Error] if you want to access "Stack". - ErrPlaywright = errors.New("playwright") - // ErrTargetClosed usually wraps a reason. - ErrTargetClosed = errors.New("target closed") - // ErrTimeout wraps timeout errors. It can be either Playwright TimeoutError or client timeout. - ErrTimeout = errors.New("timeout") -) - -// Error represents a Playwright error -type Error struct { - Name string `json:"name"` - Message string `json:"message"` - Stack string `json:"stack"` -} - -func (e *Error) Error() string { - return e.Message -} - -func (e *Error) Is(target error) bool { - err, ok := target.(*Error) - if !ok { - return false - } - if err.Name != e.Name { - return false - } - if e.Name != "Error" { - return true // same name and not normal error - } - return e.Message == err.Message -} - -func parseError(err Error) error { - if err.Name == "TimeoutError" { - return fmt.Errorf("%w: %w: %w", ErrPlaywright, ErrTimeout, &err) - } else if err.Name == "TargetClosedError" { - return fmt.Errorf("%w: %w: %w", ErrPlaywright, ErrTargetClosed, &err) - } - return fmt.Errorf("%w: %w", ErrPlaywright, &err) -} - -func targetClosedError(reason *string) error { - if reason == nil { - return ErrTargetClosed - } - return fmt.Errorf("%w: %s", ErrTargetClosed, *reason) -} |
