Skip to content

Commit

Permalink
fix(cli): yomo run sfn exit if init error (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
woorui committed May 30, 2024
1 parent 965b8d6 commit e7e4ff8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cli/serverless/golang/templates/main.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ func run(_ *cobra.Command, _ []string) {
)
{{if .WithInitFunc}}
// init
sfn.Init(Init)
if err := sfn.Init(Init); err != nil {
log.Printf("[sfn] init error[%s], %v\n", addr, err)
os.Exit(1)
}
{{end}}
// set observe data tags
sfn.SetObserveDataTags(DataTags()...)
Expand Down
5 changes: 4 additions & 1 deletion cli/serverless/golang/templates/main_rx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ func run(_ *cobra.Command, _ []string) {
)
{{if .WithInitFunc}}
// init
sfn.Init(Init)
if err := sfn.Init(Init); err != nil {
log.Printf("[sfn] init error[%s], %v\n", addr, err)
os.Exit(1)
}
{{end}}
// set observe data tags
sfn.SetObserveDataTags(DataTags()...)
Expand Down

0 comments on commit e7e4ff8

Please sign in to comment.