I have chain of router handlers defined
apis.POST(/hello, authHandler("username") , myfuncHandler)
WHow can I force stop calling myfuncHandler if authHandler has some error. I was trying to use c.Next() to move to next handler if there is no error. But I noticed that even if there is error it moves to next handler execution.
I am using gin as server.
Just return
if authHandler
has error
func authHandler(username string) {
err := auth(username)
if err != nil {
// error handling here
return
}
// otherwise proceed
c.next()
}