Skip to content

Commit ff0455f

Browse files
committed

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

polycode/apiserver.go

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,9 @@ func invokeApiHandler(c *gin.Context) {
3838
c.JSON(http.StatusInternalServerError, errorOutput)
3939
log.Println("client: api request error")
4040
} else {
41-
output, err := runApi(c, input)
42-
if err != nil {
43-
errorOutput := ErrorEvent{
44-
Error: ErrInternal.Wrap(err),
45-
}
46-
47-
c.JSON(http.StatusInternalServerError, errorOutput)
48-
log.Println("client: api request error")
49-
} else {
50-
c.JSON(http.StatusOK, output)
51-
log.Println("client: api request completed")
52-
}
41+
output := runApi(c, input)
42+
c.JSON(http.StatusOK, output)
43+
log.Println("client: api request completed")
5344
}
5445
}
5546

@@ -64,17 +55,8 @@ func invokeServiceHandler(c *gin.Context) {
6455
c.JSON(http.StatusInternalServerError, errorOutput)
6556
log.Println("client: service request error")
6657
} else {
67-
output, err := runService(c, input)
68-
if err != nil {
69-
errorOutput := ErrorEvent{
70-
Error: ErrInternal.Wrap(err),
71-
}
72-
73-
c.JSON(http.StatusInternalServerError, errorOutput)
74-
log.Println("client: service request error")
75-
} else {
76-
c.JSON(http.StatusOK, output)
77-
log.Println("client: service request completed")
78-
}
58+
output := runService(c, input)
59+
c.JSON(http.StatusOK, output)
60+
log.Println("client: service request completed")
7961
}
8062
}

0 commit comments

Comments
 (0)