gotry/try/types.tmpl
Theta-Dev 1cf7829749
All checks were successful
continuous-integration/drone/push Build is passing
Improved code generator
Better stack trace
Add try.CatchTrace, try.FromErr
2021-10-16 22:56:51 +02:00

31 lines
1.1 KiB
Cheetah

package {{.PkgName}}
// gotry auto-generated type definitions. DO NOT EDIT.
import (
{{- if .UseExt }}
"code.thetadev.de/ThetaDev/gotry/try"
{{- end}}
{{- range $pkg, $b := .Imports}}
"{{$pkg}}"
{{- end}}
)
{{range $d := .Definitions }}
// {{$d.Name}} is a helper method to handle errors of
// func() ({{range $i, $t := $d.Types}}{{$t}}, {{end}}error) functions.
func {{$d.Name}}({{range $i, $t := $d.Types}}v{{if $i}}{{$i}}{{end}} {{$t}}, {{end}}err error) (
{{- range $i, $t := $d.Types}}{{if $i}}, {{end}}{{$t}}{{end}}) {
{{if .UseExt}}try.{{end}}Check(err)
return {{range $i, $t := $d.Types}}{{if $i}}, v{{$i}}{{else}}v{{end}}{{end}}
}
{{- if $d.WithSlice}}
// {{$d.Name}}s is a helper method to handle errors of
// func() ({{range $i, $t := $d.Types}}[]{{$t}}, {{end}}error) functions.
func {{$d.Name}}s({{range $i, $t := $d.Types}}v{{if $i}}{{$i}}{{end}} []{{$t}}, {{end}}err error) (
{{- range $i, $t := $d.Types}}{{if $i}}, {{end}}[]{{$t}}{{end}}) {
{{if .UseExt}}try.{{end}}Check(err)
return {{range $i, $t := $d.Types}}{{if $i}}, v{{$i}}{{else}}v{{end}}{{end}}
}
{{- end}}
{{end}}