scotch / engineauth

Multi-Provider Authentication for App Engine
engineauth.scotchmedia.com
Other
156 stars 33 forks source link

The raising exception in the last few lines doesn't work #23

Open SpaceFlyer opened 9 years ago

SpaceFlyer commented 9 years ago

I didn't set 'lib' in my path so an exception occurred:

Traceback (most recent call last):

  File "C:\Users\SpaceFlyer\Dropbox\programming\orderonline\OrderOnline\engineauth\middleware.py", line 162, in _load_strategy

    return utils.import_class(strategy_location)

  File "C:\Users\SpaceFlyer\Dropbox\programming\orderonline\OrderOnline\engineauth\utils.py", line 29, in import_class

    mod = __import__(path, fromlist=[klass])

  File "C:\Users\SpaceFlyer\Dropbox\programming\orderonline\OrderOnline\engineauth\strategies\google.py", line 3, in 

    from apiclient.discovery import build

ImportError: No module named apiclient.discovery

INFO     2014-11-14 02:38:29,122 middleware.py:165] No module named apiclient.discovery

But instead of reporting the above exception, the last few lines generated the following information in app engine console, which is very confusing:

ERROR    2014-11-14 02:29:44,747 wsgi.py:278] 

Traceback (most recent call last):

  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 266, in Handle

    result = handler(dict(self._environ), self._StartResponse)

  File "C:\Users\SpaceFlyer\Dropbox\programming\orderonline\OrderOnline\engineauth\middleware.py", line 147, in __call__

    strategy_class = self._load_strategy(provider)

  File "C:\Users\SpaceFlyer\Dropbox\programming\orderonline\OrderOnline\engineauth\middleware.py", line 166, in _load_strategy

    "'provider.{0}' config dict".format(provider))

Exception
kylefinley commented 9 years ago

@SpaceFlyer,

Thank you for reporting this. Do you have a suggestion for a better way to handle this? Or better yet would you mind submitting a pull request?

Thanks, Kyle

SpaceFlyer commented 9 years ago

@kylefinley

I simply added traceback.print_exc() in that except Exception, e: clause. I'm not sure whether it's the best way but it surely helps me. How do you think about that? If you think it's Ok, I'll submit the pull request.

Thanks, Yuqian

kylefinley commented 9 years ago

Sounds Great!

Thanks @SpaceFlyer