You could do something like:

try:
    grid = SQLFORM.smartgrid(...)
except (db._adapter.driver.IntegrityError, db._adapter.driver.OperationalError) 
as e:
    [handle the error]

You can also define error handles for the db table:

db.mytable._on_insert_error = my_insert_error_handler
db.mytable._on_update_error = my_update_error_handler


Anthony

On Tuesday, February 24, 2015 at 8:44:41 AM UTC-5, HarryE wrote:
>
> I use SQLFORM.smartgrid for database Web interface.
> The backend performs some business rules on inserts/updates and raises 
> some errors on occasions.
> How can I nicely display the returned error text to the user ( as in 
> form.errors) and let him correct the problem, instead of being redirercted 
> to the default error handler?
>
> Maybe it's obvious, but I can't find the answer in the book.
>
> Thank you
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to