Skip to content

Commit

Permalink
Begin to catch Backend Exception
Browse files Browse the repository at this point in the history
Refs #13
  • Loading branch information
algorys committed Jul 15, 2016
1 parent bff888e commit 823895c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions alignak_app/alignak_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with (AlignakApp). If not, see <http://www.gnu.org/licenses/>.

from alignak_backend_client.client import Backend
from alignak_backend_client.client import Backend, BackendException
import future
import sys


class AlignakData(object):
Expand All @@ -44,7 +45,12 @@ def log_to_backend(self, config):
# Backend login
backend_url = config.get('Backend', 'backend_url')
self.backend = Backend(backend_url)
self.backend.login(username, password)
try:
self.backend.login(username, password)
except BackendException as e:
sys.exit('--> ERROR: ' +
str(e) +
' - Please check backend state, url and your credential.')

def get_host_state(self):
# Request
Expand Down

0 comments on commit 823895c

Please sign in to comment.