Permalink
Browse files

Make NotFound behave like Printf

  • Loading branch information...
1 parent b614953 commit ae6480d97e212b0216a1eacb6aed5067fadc71d3 @robfig committed Jan 15, 2013
Showing with 7 additions and 3 deletions.
  1. +7 −3 controller.go
View
@@ -220,7 +220,7 @@ func (c *Controller) RenderXml(o interface{}) Result {
func (c *Controller) RenderText(text string, objs ...interface{}) Result {
finalText := text
if len(objs) > 0 {
- finalText = fmt.Sprintf(text, objs)
+ finalText = fmt.Sprintf(text, objs...)
}
return &RenderTextResult{finalText}
}
@@ -234,11 +234,15 @@ func (c *Controller) Todo() Result {
})
}
-func (c *Controller) NotFound(msg string) Result {
+func (c *Controller) NotFound(msg string, objs ...interface{}) Result {
+ finalText := msg
+ if len(objs) > 0 {
+ finalText = fmt.Sprintf(msg, objs...)
+ }
c.Response.Status = http.StatusNotFound
return c.RenderError(&Error{
Title: "Not Found",
- Description: msg,
+ Description: finalText,
})
}

0 comments on commit ae6480d

Please sign in to comment.