There are situations on my site where I'd like to show the a page
telling them what they did wrong: their browser doesn't support
cookies, they erroneously try to re-submit a form, and so on.

However, I want to be notified by email whenever a user encounters one
of these errors, since I want to monitor that these errors don't
happen too frequently.

I see two options for doing this:

(1) Throw a 404/500 error whenever this occurs, and include a custom
error message in the template (e.g. "You weren't supposed to resubmit
the form."). I already have email error reporting turned on. However,
it doesn't look like there's built-in support for passing custom
strings to 404/500 templates (although I think I could just stick it
somewhere in the request object, which I can pass to the 404/500
template).

(2) Instead of throwing an error, just write a function called
report_error that emails an alert to the admin, like this:

report_error('ad...@mysite.com', request)

And then render a template to the user:

render_to_response('my_error_page.html', 'you weren't supposed to
resubmit the form')

Is there a better way of doing this? What is the best practice?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to