500 error is returned when mandatory argument is not provided
Alma-media opened this issue · comments
Alex Sch commented
Describe the bug
Proper error handling is missing
To Reproduce
running the example (functions):
$ go run main.go daemon -f ../../examples/functions/config.hcl
making the request (missing "name" parameter):
[POST] http//localhost:8080/numeric
{
"age": 35
}
getting status 500 Internal Server Error
and empty response body
Application log:
1622023136544832264 info listener.http serving HTTP listener {"addr": ":8080"}
1622023161881029516 error flow.numeric an error occurred, executing rollback {"error": "value is not set"}
github.com/jexia/semaphore/v2/pkg/broker/logger.Error
/home/alma/Projects/semaphore/pkg/broker/logger/logger.go:85
github.com/jexia/semaphore/v2/pkg/flow.(*Manager).Do
/home/alma/Projects/semaphore/pkg/flow/flow.go:154
github.com/jexia/semaphore/v2/pkg/transport/http.(*Handle).HTTPFunc
/home/alma/Projects/semaphore/pkg/transport/http/listener.go:252
github.com/julienschmidt/httprouter.(*Router).ServeHTTP
/home/alma/Projects/semaphore/vendor/github.com/julienschmidt/httprouter/router.go:387
github.com/jexia/semaphore/v2/pkg/transport/http.(*Listener).Serve.func1
/home/alma/Projects/semaphore/pkg/transport/http/listener.go:68
net/http.HandlerFunc.ServeHTTP
/usr/lib/go/src/net/http/server.go:2069
net/http.serverHandler.ServeHTTP
/usr/lib/go/src/net/http/server.go:2887
net/http.(*conn).serve
/usr/lib/go/src/net/http/server.go:1952
Expected
status 400 Bad Request
and response body containing:
{
"error": "value is not set"
}