Commit Graph

15 Commits

Author SHA1 Message Date
Camden Cheek
1d2ae644a7
Backend: replace uses of errors.Group with lib/group (#42787) 2022-10-11 10:31:22 -06:00
Keegan Carruthers-Smith
27569d1fc7
all: run gofmt -s -w from 1.19 (#41629)
gofmt in go1.19 does a lot of reformating of godoc strings, mostly to
make them more consistent around lists.

Test Plan: CI
2022-09-13 07:44:06 +00:00
Idan Varsano
c407226c05
Repo Sync: If all errors are warnings, delete repos with bad permissions (#40690)
* Prevent stopping sync if a querying for repos in Bitbucket project key returns a 'fatal' error
2022-08-24 19:26:12 +00:00
Indradhanush Gupta
e2ae15ea28
lib/errors: Assert warning against nil error in tests (#40631) 2022-08-22 21:31:43 +05:30
Ryan Slade
e49cda4784
errors: Add package level IsWarning function (#40656)
This makes it easier to check if an error is a warning without
resorting to errors.As
2022-08-22 10:56:54 +02:00
Indradhanush Gupta
432313cfee
lib/errors: Simplify ClassifiedError type to Warning (#38885)
If we are trying to expose two "levels" of errors, one being warning
and another error, it is simpler to just expose a custom type Warning
to replicate the warning level of errors, and all other errors are
just errors.

Co-authored-by: Robert Lin <robert@bobheadxi.dev>
Co-authored-by: Alex Ostrikov <alex.ostrikov@sourcegraph.com>
2022-08-03 22:40:28 +05:30
Robert Lin
d75a3733d4
lib/errors: add interfaces for typed errors (#39256)
Introducing custom error types can be tricky - I realized there's no code-level assertions or docs on Is and As implementations, so this PR introduces some interfaces to guide implementers. We write them ourselves because the standard library does not provide them, and it allows us to include docstrings better.
2022-07-25 19:59:14 -04:00
Robert Lin
2d98b0901f
trace, tracer, errors, observation: add devx to CODENOTIFY (#38897) 2022-07-18 18:19:13 +02:00
Indradhanush Gupta
089f53c5d8
lib/errors: Add new classifiedError type (#38671) 2022-07-13 16:22:28 +00:00
Keegan Carruthers-Smith
11a534cc78
lib: use any instead of interface{} (#35121)
Now that lib is on go1.18 we can use the type alias "any" instead of "interface{}".

Test Plan: cd lib && go test ./...
2022-05-09 14:55:38 +00:00
Camden Cheek
f2e2a244cd
ignore any context errors in code monitors (#35064) 2022-05-07 12:13:24 -04:00
Robert Lin
fe428b20e2
lib/errors: new MultiError error type and utilities (#31466)
Wholesale migration away from go-multierror into a custom multierror implementation that is fully compatible with cockroachdb/errors, prints all errors, can be introspected with Is, As, and friends, and more. The new MultiError type is only available as an interface.

Co-authored-by: Camden Cheek <camden@ccheek.com>
2022-02-18 11:07:02 -08:00
Camden Cheek
233a93abc6
Add helper predicates for HasType and Is (#30975)
This adds a couple of small helpers to make working with errors.Ignore a
little easier. Now, if you just want to ignore a certain error type,
instead of creating a function for it, you can just do something like
```
err = errors.Ignore(err, errors.IsPred(context.Canceled))
```
2022-02-10 16:47:46 +00:00
Camden Cheek
f5a2e023cb
Add errors.Ignore() (#30930)
This adds the new helper function `Ignore` to our `errors` package. This
allows us to ignore errors based on a given predicate function in a way
that takes into account aggregated errors in MultiError. It recursively
unwraps to multierrors an filters out all child errors that match the
predicate.
2022-02-09 16:15:45 -07:00
Eric Fritz
7148009913
errors: Introduce internal package (#30558) 2022-02-07 15:03:45 +00:00