I'm throwing some error in my route handler:
func getQuestion(c *gin.Context) {
err := errors.New("some error")
c.JSON(http.StatusNotFound, gin.H{"msg": err.Error()})
}
And inside the middleware:
func errorMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
// Now, how to get that "some error"?
Comment From: bhojport
Ah, I have to put error in context:
c.Error(err)