Skip to content

Commit

Permalink
doc: type assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
DenChenn committed Sep 6, 2023
1 parent f1056b5 commit 01e8b35
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,13 @@ if errors.Is(err, &pgx.ErrNoRows) {
return &alayer.Err1.Wrap(err)
}
```

## Type assertion
All generated errors implement `blunder.OrdinaryError` interface, which contains static methods.

```go
ordinaryError, ok := err.(blunder.OrdinaryError)
if ok {
fmt.Println(ordinaryError.GetId())
}
```

0 comments on commit 01e8b35

Please sign in to comment.