Isn't it true that the choice between using a return error code and
using the exception mechanism is decided by whether the result is
expected or not? If record_not_found is a common, reasonably expected
outcome then maybe it is better to use a return code to signal this so
that the logic to deal with it is inline with the algorithm of the
function. If a record exists but the read fails that might always be
an exception case, but trying to read a record and not knowing first
whether it exists may be better handled by the inline control logic.

That is, don't most other systems use a return code to single
not_in_table rather than using exception facility?

Isn't it best to reserve use of the exception mechanism for errors
that should _rarely_ happen and needn't be covered by the inline
logic?

--

On Jul 11, 9:06 am, Vidul <vidul.pet...@gmail.com> wrote:
> Probably RecordNotFound exception or just an attribute like
> crud.setting.record_not_found?
>
> On Jul 11, 7:01 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > You are right. we need to deal with that exception somehow. What do
> > you propose?
>
> > massimo
>
> > On Jul 11, 10:13 am, Vidul <vidul.pet...@gmail.com> wrote:
>
> > > For example:
>
> > > def update_comment():
> > >     form=crud.update(db.comment, request.args(0))
> > >     retur dict(form=form)
>
> > > where args(0) does not exist in the database.
>
> > > On Jul 11, 5:51 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > What kind of exceptions?
>
> > > > On Jul 11, 7:04 am, Vidul <vidul.pet...@gmail.com> wrote:
>
> > > > > Hi,
>
> > > > > Auth and CRUD are amazing, no doubt, but is there a best practice for
> > > > > the exception handler / ing of read / create / update / delete
> > > > > actions?
>
> > > > > Thank you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to