~bigbes/core-go

core-go/errors d---------
7f734c73 — Conrad Hoffmann 3 months ago
errors: fix comparison in errors.Is()

The code operates compares two values of compile-time type `any`. The
common use case however is to compare an error from `client.Do()` to one
of the reference errors, for example:

    if errors.Is(err, errors.ErrNotFound) {
        ...
    }

However, due to how the reference errors are constructed, their error
codes are of runtime-type `errors.ErrorCode`, whereas anything that got
parsed from a JSON response by `gqlerrors` will always be of
runtime-type `string`. Hence, Go will consider the two instances not
equal at runtime. Here [1] is little playground example demonstrating
the behavior.

To fix it, simply cast the special error type to back to string before
putting it in the map.

[1]: https://go.dev/play/p/pzxuhnnIeIK
32f48281 — Conrad Hoffmann 4 months ago
errors: add ERR_REDIRECT

This error is meant to be returned if a resource is requested that does
not exist under the requested name anymore but was moved to a different
resource.
52237268 — Drew DeVault 8 months ago
errors: add errors.Is
862728a4 — Drew DeVault 9 months ago
server: add error presenter to make context cancellation semantic
09368917 — Drew DeVault 9 months ago
auth: ensure semantic errors are bubbled up to user properly
038a9eb0 — Drew DeVault 10 months ago
auth: add error code on unauthorized request response
29a3ebfe — Taavi Väänänen 1 year, 4 months ago
errors: Fix ErrUnsupported error code
d89f65e8 — Drew DeVault 1 year, 4 months ago
errors.Field: return the error
1e3cd785 — Drew DeVault 1 year, 5 months ago
errors: add ERR_UNSUPPORTED
8e729e75 — Drew DeVault 1 year, 5 months ago
errors: new module for common GQL errors

This package provides a means of creating GraphQL-aware errors and
a location for common error codes.