Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
deankarn committed Aug 16, 2023
1 parent 56976f0 commit 15ea2a8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.3.3] - 2023-08-16
### Fixed
- First error inconsistently wrapped with error and prefix instead of err then prefix in the chain.

## [5.3.2] - 2023-08-16
### Fixed
- Link Error output missing error when prefix was blank.
Expand Down Expand Up @@ -41,7 +45,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated deps.


[Unreleased]: https://github.com/go-playground/errors/compare/v5.3.2...HEAD
[Unreleased]: https://github.com/go-playground/errors/compare/v5.3.3...HEAD
[5.3.3]: https://github.com/go-playground/errors/compare/v5.3.2...v5.3.3
[5.3.2]: https://github.com/go-playground/errors/compare/v5.3.1...v5.3.2
[5.3.1]: https://github.com/go-playground/errors/compare/v5.3.0...v5.3.1
[5.3.0]: https://github.com/go-playground/errors/compare/v5.2.3...v5.3.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package errors
============
![Project status](https://img.shields.io/badge/version-5.3.2-green.svg)
![Project status](https://img.shields.io/badge/version-5.3.3-green.svg)
[![Build Status](https://travis-ci.org/go-playground/errors.svg?branch=master)](https://travis-ci.org/go-playground/errors)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/errors)](https://goreportcard.com/report/github.com/go-playground/errors)
[![GoDoc](https://godoc.org/github.com/go-playground/errors?status.svg)](https://pkg.go.dev/github.com/go-playground/errors/v5)
Expand Down
4 changes: 2 additions & 2 deletions chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (c Chain) Is(target error) bool {
}
target = innerErr[0].Err
}
return stderrors.Is(c[0].Err, target)
return stderrors.Is(c[len(c)-1].Err, target)
}

// As finds the first error in the error chain that matches target, and if so, sets
Expand All @@ -245,7 +245,7 @@ func (c Chain) As(target any) bool {
if len(c) == 0 {
return false
}
return stderrors.As(c[0].Err, target)
return stderrors.As(c[len(c)-1].Err, target)
}

func defaultFormatFn(c Chain) string {
Expand Down
3 changes: 1 addition & 2 deletions errors.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package errors

import (
"errors"
stderrors "errors"
"fmt"
"reflect"
Expand Down Expand Up @@ -38,7 +37,7 @@ func RegisterErrorFormatFn(fn ErrorFormatFn) {

// New creates an error with the provided text and automatically wraps it with line information.
func New(s string) Chain {
return wrap(errors.New(s), "", 3)
return wrap(stderrors.New(s), "", 3)
}

// Newf creates an error with the provided text and automatically wraps it with line information.
Expand Down

0 comments on commit 15ea2a8

Please sign in to comment.