如果前一个处理程序gin中存在错误,如何停止下一个处理程序的执行

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()
}