From b8f02dc8ab65929564193d330e648c4ca93c8f98 Mon Sep 17 00:00:00 2001 From: Max Siegieda Date: Thu, 8 Nov 2018 13:47:09 +0000 Subject: [PATCH] Return error if internal error occurs (#301) * fix cases of not returning error through InternalError --- handlers/api/build.go | 2 +- handlers/api/deployment.go | 2 +- handlers/api/graph.go | 2 +- handlers/api/simulation.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handlers/api/build.go b/handlers/api/build.go index 093ceb16..45592d59 100644 --- a/handlers/api/build.go +++ b/handlers/api/build.go @@ -277,7 +277,7 @@ func (b Build) CreateEvent(c *gin.Context) { } if err != nil { - sugar.InternalError(c, nil) + sugar.InternalError(c, err) return } eventMessage := "Build entered state:" + event.Status diff --git a/handlers/api/deployment.go b/handlers/api/deployment.go index ffb5f5e2..3e2dc9f6 100644 --- a/handlers/api/deployment.go +++ b/handlers/api/deployment.go @@ -269,7 +269,7 @@ func (d Deployment) CreateEvent(c *gin.Context) { newEvent, err := d.AddEvent(c, dep, event) if err != nil { - sugar.InternalError(c, nil) + sugar.InternalError(c, err) return } diff --git a/handlers/api/graph.go b/handlers/api/graph.go index 0229748d..ab1948d6 100644 --- a/handlers/api/graph.go +++ b/handlers/api/graph.go @@ -241,7 +241,7 @@ func (g Graph) CreateEvent(c *gin.Context) { newEvent, err := BatchService{AWS: g.AWS}.AddEvent(&graph.BatchJob, event) if err != nil { - sugar.InternalError(c, nil) + sugar.InternalError(c, err) return } diff --git a/handlers/api/simulation.go b/handlers/api/simulation.go index 6291ccc0..30ef560b 100644 --- a/handlers/api/simulation.go +++ b/handlers/api/simulation.go @@ -226,7 +226,7 @@ func (s Simulation) CreateEvent(c *gin.Context) { newEvent, err := BatchService{AWS: s.AWS}.AddEvent(&sim.BatchJob, event) if err != nil { - sugar.InternalError(c, nil) + sugar.InternalError(c, err) return }