Skip to content

implement Exception.Unwrap method #126

implement Exception.Unwrap method

implement Exception.Unwrap method #126

Triggered via pull request October 14, 2024 06:48
Status Failure
Total duration 22s
Artifacts

pr.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

1 error
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