Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
viatoriche authored Oct 17, 2024
1 parent 31618e1 commit 506a74f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
func main() {
err := stacktrace.New("An error occurred", stacktrace.WithLocation("/path/to/file"), stacktrace.WithPosition(stacktrace.NewPosition(10, 1)))
fmt.Println(err)
// Output:
// /path/to/file:10:1: An error occurred
// Output:
// /path/to/file:10:1: An error occurred
}
```

Expand All @@ -49,17 +49,17 @@ func main() {
baseErr := fmt.Errorf("base error")
wrappedErr := stacktrace.NewWrapped("an error occurred", baseErr, stacktrace.WithLocation("/path/to/file"), stacktrace.WithPosition(stacktrace.NewPosition(10, 1)))
fmt.Println(wrappedErr)
// Output:
// /path/to/file:10:1: an error occurred: base error
// Output:
// /path/to/file:10:1: an error occurred: base error

unwrappedErr, ok := stacktrace.Unwrap(wrappedErr)
if ok {
fmt.Println(unwrappedErr)
}

wrappedErr2 := stacktrace.Wrap(baseErr, stacktrace.WithLocation("/path/to/file"), stacktrace.WithPosition(stacktrace.NewPosition(10, 1)))
fmt.Println(wrappedErr2)
// Output:
fmt.Println(wrappedErr2)
// Output:
// /path/to/file:10:1: base error
}
```
Expand Down Expand Up @@ -107,4 +107,4 @@ func main() {
* `WithEnsureDuplicates() TracesOpt`: Ensures that duplicates are not printed in traces.

## Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contributions are welcome! Please open an issue or submit a pull request.

0 comments on commit 506a74f

Please sign in to comment.