Skip to content

Commit

Permalink
Merge pull request #1 from klynch/master
Browse files Browse the repository at this point in the history
Better exception handling
  • Loading branch information
jasonarewhy committed Sep 10, 2014
2 parents dece755 + 7745381 commit d982e47
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions catchpoint.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env python

import sys
import base64
import datetime
import pytz
import requests


class CatchpointError(Exception):
pass


class Catchpoint(object):

def __init__(
Expand Down Expand Up @@ -82,6 +84,8 @@ def _make_request(self, uri, params=None, data=None):
}
try:
r = requests.get(uri, headers=headers, params=params, data=data)
if r.status_code != 200:
raise CatchpointError(r.content)
except requests.ConnectionError, e:
self._connection_error(e)

Expand Down

0 comments on commit d982e47

Please sign in to comment.