How to catch "TypeError: No such value for MURKS in Enum ObjectTypes" when protorpc is called with 'wrong' parameters?

13 views
Skip to first unread message

Carsten Germer

unread,
Dec 10, 2012, 6:28:53 AM12/10/12
to google-prot...@googlegroups.com
Hi everyone, joyfully protorpc-ing my GAE-application here, very nice :-)
Unittesting with webtests and calling with curl, fine so far.

Now, if curl-ing a method that expects an EnumField of messages.Enum also works fine as long as I provide correct values for this parameter.
If I don't, curl shows no answer at all (gets 500) and the server (local development) throws an error (see below).

What would be a good way to catch an error like this and provide the caller with a decent error message (in addition to HTTP 500)?
Can't seem to find anything in docs or discussion. Ideas?

ERROR    2012-12-10 10:54:44,646 wsgi.py:235] 
Traceback (most recent call last):
  File "/Applications/GoogleAppEngine/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 223, in Handle
    result = handler(dict(self._environ), self._StartResponse)
  File "/Applications/GoogleAppEngine/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/protorpc/protorpc/wsgi/util.py", line 161, in first_found_app
    response = app(environ, first_found_start_response)
  File "/Applications/GoogleAppEngine/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/protorpc/protorpc/wsgi/service.py", line 153, in protorpc_service_app
    remote_info.request_type, environ['wsgi.input'].read(content_length))
  File "/Applications/GoogleAppEngine/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/protorpc/protorpc/remote.py", line 1123, in decode_message
    return self.__protocol.decode_message(message_type, encoded_message)
  File "/Applications/GoogleAppEngine/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/protorpc/protorpc/protojson.py", line 214, in decode_message
    message = decode_dictionary(message_type, dictionary)
  File "/Applications/GoogleAppEngine/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/protorpc/protorpc/protojson.py", line 188, in decode_dictionary
    item = field.type(item)
  File "/Applications/GoogleAppEngine/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/protorpc/protorpc/messages.py", line 437, in __new__
    (index, cls.__name__))
TypeError: No such value for MURKS in Enum ObjectTypes

Rafe Kaplan

unread,
Dec 10, 2012, 4:23:45 PM12/10/12
to google-prot...@googlegroups.com
There is a fix in process:

http://google-protorpc-review.appspot.com/86001/

I can't say when it will make it's way in to production, but it
won't be too long. In the meantime, do you know how to make use of
your own version of ProtoRPC so that you don't have to wait?
--
- Rafe Kaplan

Rafe Kaplan

unread,
Dec 10, 2012, 4:29:11 PM12/10/12
to google-prot...@googlegroups.com
I've pushed the fix to source control.
--
- Rafe Kaplan

Carsten Germer

unread,
Dec 11, 2012, 3:13:52 AM12/11/12
to google-prot...@googlegroups.com
Hi Rafe, thanks a lot and it's fine, I'm still in early alpha so no hurry from my side ^_^
Got to find my way through efficient (good) use of async, transactional and tasklets in my application first, anyway :-P
Reply all
Reply to author
Forward
0 new messages