Skip to content

Commit

Permalink
use errors as a root cause
Browse files Browse the repository at this point in the history
  • Loading branch information
teru01 committed May 12, 2024
1 parent 7664a47 commit 8ede9d2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions examples/stacktrace_print/main.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package main

import (
"errors"
"log"

"github.com/m-mizutani/goerr"
)

func nestedAction2() error {
return goerr.New("fatal error in the nested action2")
return errors.New("fatal error in the nested action2")
}

func nestedAction() error {
return goerr.Wrap(nestedAction2(), "nestedAction2 failed")
}

func someAction() error {
if err := nestedAction(); err != nil {
return goerr.Wrap(err, "nestedAction failed")
}
return nil
return goerr.Wrap(nestedAction(), "nestedAction failed")
}

func main() {
Expand Down

0 comments on commit 8ede9d2

Please sign in to comment.