Skip to content

implement Exception.Unwrap method #1174

implement Exception.Unwrap method

implement Exception.Unwrap method #1174

Triggered via pull request October 10, 2023 08:27
Status Failure
Total duration 2m 17s
Artifacts

x.yml

on: pull_request
Matrix: test / run
Fit to window
Zoom out
Zoom in

Annotations

4 errors
commit / lint
You have commit messages with errors ⧗ input: implement Exception.Unwrap method In order to make exceptions testable with errors.Is, they must implement the `Unwrap` method to allow access to the underlying error code(s). This change is addressing the problem of the below code not working as expected, when testing returned by `Do` method error: c, _ := ch.Dial(ctx, ch.Options{...}) switch err := c.Do(ctx, ch.Query{...}); { case err == nil: // ... case errors.Is(err, proto.ErrTableIsReadOnly), errors.Is(err, proto.ErrReadonly): // ... <- Never executed, because exception unwraping is not implemented. default: // ... } Because `Exception` instances are created dynamically, unwrapping can ignore nested exception instances and collect only the underlying error codes. ✖ subject may not be empty [subject-empty] ✖ type may not be empty [type-empty] ✖ found 2 problems, 0 warnings ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
lint / run: client.go#L150
G601: Implicit memory aliasing in for loop. (gosec)
lint / run: client_test.go#L116
unnecessary trailing newline (whitespace)
lint / run
issues found