You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One frustration I've found while using pushup follows this template:
^handler {
if (someCondition) {
w.WriteHeader(404)
return nil
}
}
<p>
This is my normal content.
</p>
When sending the error status code, I'd like to provide error page content. However rendering that content requires falling back to a conventional go web framework approach. However part of why I chose pushup for a particular app is to void the duties of setting up a conventional web framework. The path of least resistance is to redirect to an error page. However that provides a pretty poor user experience. e.g. It is difficult to link to the page that provided the 404 when a user finds it unexpected.
I haven't checked the implementation to see how feasible this is, but within the pushup paradigm, I'd like to be able to communicate more to the outer pushup controller via a richer return value:
That would allow defining the behavior of an error page as a page, routeable and testable on it's own, but also without requiring a redirect. It would also tie the intended effect to the return value, so the user could no longer forget to return after indicating an error with w.WriteHeader(...).
These enhanced return values could redirects as well. Currently, calling http.Redirect(...) and then having to also explicitly return nil can be a bit error prone.
If the return value of a handler is not a practical way to deliver this functionality, perhaps a library function could be provided that does something similar to the code routing and rendering functionality:
One frustration I've found while using pushup follows this template:
When sending the error status code, I'd like to provide error page content. However rendering that content requires falling back to a conventional go web framework approach. However part of why I chose pushup for a particular app is to void the duties of setting up a conventional web framework. The path of least resistance is to redirect to an error page. However that provides a pretty poor user experience. e.g. It is difficult to link to the page that provided the 404 when a user finds it unexpected.
I haven't checked the implementation to see how feasible this is, but within the pushup paradigm, I'd like to be able to communicate more to the outer pushup controller via a richer return value:
That would allow defining the behavior of an error page as a page, routeable and testable on it's own, but also without requiring a redirect. It would also tie the intended effect to the return value, so the user could no longer forget to return after indicating an error with
w.WriteHeader(...)
.These enhanced return values could redirects as well. Currently, calling
http.Redirect(...)
and then having to also explicitly returnnil
can be a bit error prone.If the return value of a handler is not a practical way to deliver this functionality, perhaps a library function could be provided that does something similar to the code routing and rendering functionality:
This would retain the benefits of the prior suggestion while still requiring the user to remember to return
nil
.The text was updated successfully, but these errors were encountered: