Skip to content

Commit

Permalink
Report only one error using eval.TooManyArgError()
Browse files Browse the repository at this point in the history
  • Loading branch information
tchssk committed May 16, 2024
1 parent 3dc0890 commit abe4753
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions dsl/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ func Param(name string, args ...any) {
func MapParams(args ...any) {
if len(args) > 1 {
eval.TooManyArgError()
return
}
e, ok := eval.Current().(*expr.HTTPEndpointExpr)
if !ok {
Expand Down
2 changes: 2 additions & 0 deletions dsl/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import (
func Payload(val any, args ...any) {
if len(args) > 2 {
eval.TooManyArgError()
return
}
e, ok := eval.Current().(*expr.MethodExpr)
if !ok {
Expand Down Expand Up @@ -125,6 +126,7 @@ func Payload(val any, args ...any) {
func StreamingPayload(val any, args ...any) {
if len(args) > 2 {
eval.TooManyArgError()
return
}
e, ok := eval.Current().(*expr.MethodExpr)
if !ok {
Expand Down
1 change: 1 addition & 0 deletions dsl/result_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func ResultType(identifier string, args ...any) *expr.ResultTypeExpr {
}
if len(args) > 2 {
eval.TooManyArgError()
return nil
}
}
}
Expand Down
1 change: 1 addition & 0 deletions dsl/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
func Server(name string, fn ...func()) *expr.ServerExpr {
if len(fn) > 1 {
eval.TooManyArgError()
return nil
}
api, ok := eval.Current().(*expr.APIExpr)
if !ok {
Expand Down

0 comments on commit abe4753

Please sign in to comment.