summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@thoughtworks.com>2014-10-22 18:22:56 +0200
committerBruno Wagner <bwagner@thoughtworks.com>2014-10-22 18:28:23 +0200
commit0d21d7202bae83c96a05ac1aaa025722a420ca45 (patch)
tree97875a104cfeebb70a32164f5bed876fa2e801f3 /service/pixelated
parent8412ddc7af85aafae57dc7ce04e77a16fe4c331c (diff)
If we can't connect to the provider or the credentials are wrong, you get a meaningful error now
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/config/app_factory.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/service/pixelated/config/app_factory.py b/service/pixelated/config/app_factory.py
index 687d00b3..6943210b 100644
--- a/service/pixelated/config/app_factory.py
+++ b/service/pixelated/config/app_factory.py
@@ -23,9 +23,12 @@ from pixelated.adapter.search import SearchEngine
from pixelated.adapter.draft_service import DraftService
from pixelated.adapter.mailbox_indexer_listener import MailboxIndexerListener
import pixelated.bitmask_libraries.session as LeapSession
+from pixelated.bitmask_libraries.leap_srp import LeapAuthException
+from requests.exceptions import ConnectionError
from pixelated.controllers import *
from pixelated.adapter.tag_service import TagService
import os
+import sys
from leap.common.events import (
register,
events_pb2 as proto
@@ -73,9 +76,17 @@ def _setup_routes(app, home_controller, mails_controller, tags_controller, featu
def create_app(debug_enabled, app):
with app.app_context():
- leap_session = LeapSession.open(app.config['LEAP_USERNAME'],
+ try:
+ leap_session = LeapSession.open(app.config['LEAP_USERNAME'],
app.config['LEAP_PASSWORD'],
app.config['LEAP_SERVER_NAME'])
+ except ConnectionError, error:
+ print("Can't connect to the requested provider")
+ sys.exit(1)
+ except LeapAuthException:
+ print("Couldn't authenticate with the credentials provided")
+ sys.exit(1)
+
tag_service = TagService()
search_engine = SearchEngine()
pixelated_mail_sender = MailSender(leap_session.account_email())