From 20463fa725a9d8eaf5537633f5ca28691b5265f6 Mon Sep 17 00:00:00 2001 From: smallfish Date: Wed, 13 Aug 2014 17:26:22 +0800 Subject: [PATCH] Add CustomAbort() for Controller, support status code and body --- controller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controller.go b/controller.go index 6f7b510c..ecc585e2 100644 --- a/controller.go +++ b/controller.go @@ -274,6 +274,11 @@ func (c *Controller) Abort(code string) { } } +// CustomAbort stops controller handler and show the error data, it's similar Aborts, but support status code and body. +func (c *Controller) CustomAbort(status int, body string) { + c.Ctx.Abort(status, body) +} + // StopRun makes panic of USERSTOPRUN error and go to recover function if defined. func (c *Controller) StopRun() { panic(USERSTOPRUN)