It all depends what is "natural" for end user point of view.

If parameter is something like start or end value I think that the most
convenient thing is to provide some reasonable default if variable is
missing or is incorrect type. Then you may use logging facility to log to
some logger (debug, warn, errror) that value provided was incorrect and was
replaced by default value.

I only do 500-errors when something really critical happens (basically
programming error) in application and request can't proceed.

On Wed, Jul 11, 2012 at 4:47 PM, Andre Schemschat <dai...@web.de> wrote:

> Hi everybody,
> i'm currently working on my first django-application and stumbled upon a
> design issue, which i cant quite decide how to handle and i thought i may
> ask here, if there are any guidelines as to how to handle this :)
> In my view i have, naturally, some code to process the request and return
> a response. This code needs a get-parameter to operate within boundaries
> and this parameter is always provided within the application (Its an
> ajax-callback).
> The question now is, what to do if the parameter is not provided somehow.
> Should i catch the resulting KeyError (Or any unexpected exception in any
> view for that matter) and just redirect to a safe page, log the error away
> and display a warning to the user or should i just let the error pass (in
> debug show the error info page, in production the 500-page), since it
> shouldnt have happend within the application?
> I'm currently tending towards the second option, because in production
> there is the 500-page, so the user doesnt get to see ugly errors and with
> an error-handling middleware i can log the exceptions and in debug its
> easier to take care of the bug, but i like to hear some opinions from the
> more experienced django-devs in here, cause i'm sure im missing some vital
> point :D
>
> Thanks&Grettings,
> Andre
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/bQyS-29Lb4QJ.
> 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.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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