import ( "net/http" "github.com/go-gitea/gitea/modules/middleware" ) func myHandler(w http.ResponseWriter, r *http.Request) { ctx := middleware.GetContext(r) // Perform some operation that may throw an error err := someOperation() if err != nil { ctx.HasError = true } // Continue with processing the request // ... middleware.NextHandler(w, r) }In the above example, if the `someOperation()` function returns an error, the `ctx.HasError` flag is set to true. The `NextHandler()` function then passes the control to the next middleware in the chain. Overall, the Context HasError middleware is a useful tool for handling errors in Gitea while maintaining a clean and modular code structure.