cloudapi: use Recover middleware to handle panics
recover from panics such as out-of-bounds array access & nil pointer access, print a stack trace and return 5xx error instead of the service crashing and relying on Execution framework to handle crashes
This commit is contained in:
parent
bc9e340ca5
commit
60e403e53e
34 changed files with 4304 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
|
|
@ -58,6 +59,8 @@ func (server *Server) Handler(path string) http.Handler {
|
|||
e.StdLogger = server.logger
|
||||
e.Pre(common.OperationIDMiddleware)
|
||||
|
||||
e.Use(middleware.Recover())
|
||||
|
||||
handler := apiHandlers{
|
||||
server: server,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue