Skip to content

Commit

Permalink
fix(generator): add missing err return
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov committed Feb 7, 2024
1 parent 6be21d8 commit 314e747
Show file tree
Hide file tree
Showing 35 changed files with 664 additions and 1 deletion.
1 change: 1 addition & 0 deletions client_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,11 @@ func exec() error {
),
}

ifErr := jen.If(jen.Err().Op("!=").Nil()).Block(returnErr)
if rsp == nil {
block = append(block, jen.Return(jen.Err()))
} else {
block = append(block, ifErr)
outReturn := jen.Id("out")
if rsp.CamelName != schemaOut.CamelName {
// Takes original name and turns to camel.
Expand All @@ -333,7 +335,7 @@ func exec() error {
block,
jen.Id("out").Op(":=").New(jen.Id(schemaOut.CamelName)),
jen.Err().Op("=").Qual("encoding/json", "Unmarshal").Call(jen.Id("b"), jen.Id("out")),
jen.If(jen.Err().Op("!=").Nil()).Block(returnErr),
ifErr,
jen.Return(outReturn, jen.Nil()),
)
}
Expand Down
36 changes: 36 additions & 0 deletions handler/account/account.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions handler/accountauthentication/accountauthentication.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions handler/accountteam/accountteam.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions handler/accountteammember/accountteammember.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions handler/billinggroup/billinggroup.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions handler/clickhouse/clickhouse.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions handler/cloud/cloud.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 314e747

Please sign in to comment.