code: func handleInvocationPanic(c *Controller, err interface{}) {
  	error := NewErrorFromPanic(err)
  	if error != nil {
  		utilLog.Error("PanicFilter: Caught panic", "error", err, "stack", error.Stack)
  		if DevMode {
  			fmt.Println(err)
  			fmt.Println(error.Stack)
  		}
  	} else {
  		utilLog.Error("PanicFilter: Caught panic, unable to determine stack location", "error", err, "stack", string(debug.Stack()))
  		if DevMode {
  			fmt.Println(err)
  			fmt.Println("stack", string(debug.Stack()))
  		}
  	}
  
  	if error == nil && DevMode {
  		// Only show the sensitive information in the debug stack trace in development mode, not production
  		c.Response.SetStatus(http.StatusInternalServerError)
  		_, _ = c.Response.GetWriter().Write(debug.Stack())
  		return
  	}
  
  	c.Result = c.RenderError(error)
  }
docs: // This function handles a panic in an action invocation.
  // It cleans up the stack trace, logs it, and displays an error page.