Hi J,

On Fri, Jan 29, 2010 at 3:18 PM, J <[email protected]> wrote:

> Hi Everyone,
>
> Background: Recommended practice for dealing with the Data Store is to
> be prepared for the occasional failure. Within a transaction, when in
> test mode, I simulate a transaction failure by randomly raising the
> Rollback exception. This practice allows us to validate the exception
> paths of the code when in test mode.
>
> Now the question: when in test mode, is there a way to cause Model.put
> () to raise an exception so we could test for this? Something should
> be possible with hooks but if there is an existing best practice
> around this, I would love to use it and/or build on it.
>

Using hooks would be your best option. Define a pre-call hook for the Get
operation that raises an exception when you want it to. My article on hooks
demonstrates how to make this easier with a hooking class:

http://blog.notdot.net/2009/11/API-call-hooks-for-fun-and-profit

-Nick


>
> Thanks.
>
> J Singh
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to