Skip to content

Instantly share code, notes, and snippets.

@podhmo

podhmo/00.output

Created Sep 18, 2020
Embed
What would you like to do?
2020/09/19 08:07:00 ! on f: on g: hmm
2020/09/19 08:07:00 !!hmm
on g
main.g
./00errors/main00.go:18
main.f
./00errors/main00.go:15
main.main
./00errors/main00.go:12
runtime.main
/opt/local/lib/go/src/runtime/proc.go:204
runtime.goexit
/opt/local/lib/go/src/runtime/asm_amd64.s:1374
on f
2020/09/19 08:07:18 ! on f: on g: hmm
2020/09/19 08:07:18 !! on f: on g: hmm
2020/09/19 08:13:53 ! on f: on g: hmm
2020/09/19 08:13:53 !!on f: on g: hmm
package main
import (
"fmt"
"log"
"github.com/pkg/errors"
)
func main() {
log.Printf("! %v", f())
log.Printf("!!%+v", f())
}
func f() error {
return errors.WithMessage(g(), "on f")
}
func g() error {
return errors.Wrap(h(), "on g")
}
func h() error {
return fmt.Errorf("hmm")
}
package main
import (
"fmt"
"log"
)
func main() {
log.Printf("! %v", f())
log.Printf("!! %+v", f())
}
func f() error {
return fmt.Errorf("on f: %w", g())
}
func g() error {
return fmt.Errorf("on g: %w", h())
}
func h() error {
return fmt.Errorf("hmm")
}
package main
import (
"fmt"
"log"
"github.com/k0kubun/pp"
"github.com/pkg/errors"
)
func main() {
log.Printf("! %v", f())
log.Printf("!!%+v", f())
pp.Println(f())
}
func f() error {
return fmt.Errorf("on f: %w", g())
}
func g() error {
return errors.Wrap(h(), "on g")
}
func h() error {
return fmt.Errorf("hmm")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.