I do not understand what have happened . But today all works ;)

res <- runDB $ E.catch (insertBy offer) (\(e :: E.SomeException) -> return $ Left undefined)

But sometimes i see in console follow:

Attempting to interpret your app...
wai-handler-devel: user error (SQLite3 returned ErrorBusy while attempting to perform close: unable to close due to unfinalised statements)



2011/4/26 Anton Cheshkov <acheshkov@gmail.com>
I can not catch exception
user error (SQLite3 returned ErrorConstraint while attempting to perform step.)

I do it as:
res <- runDB $ E.catch (insertBy offer) (\(e :: E.SomeException) -> return $ Left undefined)

2011/4/26 Anton Cheshkov <acheshkov@gmail.com>
Ok.

I recompiled persistent with new changes. All works how i want and expect.
But now   insertBy function are not so safe as earlier. 

The insertBy function checks only unique constrains defined on yesod framework level via Unique... constructions  .
Now  insertBy function throws exception if we try to insert 'bad' value to column with foreign constraint. 

Please show me how to catch exception. 
I think it would something like:

import qualified Control.Exception.Control as E
...
do
   res <- runDB $ E.catch (insertBy offer) (\_ -> return Left ())

But my exception handler is wrong. 


Thanks.

2011/4/26 Greg Weber <greg@gregweber.info>
Thanks!

Please send a pull request to Michael.

On Tue, Apr 26, 2011 at 5:58 AM, Anton Cheshkov <acheshkov@gmail.com> wrote:
I have pushed branch to fix it. probably it should be helpful. 

Thanks.


2011/4/26 Anton Cheshkov <acheshkov@gmail.com>
Hi Michael. 

Please show the way to enable foreign key support from sqlite connection.

Now foreign key constrints does not work for sqlite from Yesod.

Thanks.



--
Best regards,
Cheshkov Anton
Phone: +7 909 005 18 82
Skype: cheshkov_anton



--
Best regards,
Cheshkov Anton
Phone: +7 909 005 18 82
Skype: cheshkov_anton

_______________________________________________
web-devel mailing list
web-devel@haskell.org
http://www.haskell.org/mailman/listinfo/web-devel





--
Best regards,
Cheshkov Anton
Phone: +7 909 005 18 82
Skype: cheshkov_anton



--
Best regards,
Cheshkov Anton
Phone: +7 909 005 18 82
Skype: cheshkov_anton



--
Best regards,
Cheshkov Anton
Phone: +7 909 005 18 82
Skype: cheshkov_anton