Thursday, April 28, 2011

Top 5 exceptions in Google App Engine - Sfalma Blog

Top 5 exceptions in Google App Engine - Sfalma Blog: "1. Routing Exceptions
The most common exception is the routing exception. Usually a resource is missing (like /favicon.png - the most common file missing).
2. Timeouts
One of the biggest headaches in GAE is timeouts (usually due to database queries or urlfetch). Either the service you are trying to connect is taking too much time to respond or you have a very complex/slow query. You can solve it by using AppStats (you are using AppStats right?) or putting retries (usually around 3 - you don’t want to drain your resources on something that is not working).
3. UnicodeDecodeError 
“ascii codec can’t encode characters in position 56-62: ordinal not in range(128)”
Everyone hates those nasty strings. encode, decode, utf-8, ascii - come on! please work! Pro-tip: always bet on utf-8.
4. Method Not Allowed
You have a route that waits for POST but you are doing a GET (vice-versa is not so common).
5. AttibuteError - NoneType
AttributeError: ‘NoneType’ object has no attribute ‘lat’
You expected that some object existed and you tried to access an attribute right? Admit it! Always check if a query returned any results.
6 (bonus). Your errors
Values, DivideByZero and many more."