projects
/
osm
/
osmclient.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Capture end organize exceptions. Fix NotFound
[osm/osmclient.git]
/
osmclient
/
sol005
/
project.py
diff --git
a/osmclient/sol005/project.py
b/osmclient/sol005/project.py
index
39d2453
..
dc2e9a5
100644
(file)
--- a/
osmclient/sol005/project.py
+++ b/
osmclient/sol005/project.py
@@
-20,8
+20,8
@@
OSM project mgmt API
"""
from osmclient.common import utils
"""
from osmclient.common import utils
+from osmclient.common.exceptions import ClientException
from osmclient.common.exceptions import NotFound
from osmclient.common.exceptions import NotFound
-from osmclient.common.exceptions import OsmHttpException
import json
import logging
import json
import logging
@@
-50,7
+50,7
@@
class Project(object):
if resp:
resp = json.loads(resp)
if not resp or 'id' not in resp:
if resp:
resp = json.loads(resp)
if not resp or 'id' not in resp:
- raise
OsmHttp
Exception('unexpected response from server - {}'.format(
+ raise
Client
Exception('unexpected response from server - {}'.format(
resp))
print(resp['id'])
#else:
resp))
print(resp['id'])
#else:
@@
-76,7
+76,7
@@
class Project(object):
if resp:
resp = json.loads(resp)
if not resp or 'id' not in resp:
if resp:
resp = json.loads(resp)
if not resp or 'id' not in resp:
- raise
OsmHttp
Exception('unexpected response from server - {}'.format(
+ raise
Client
Exception('unexpected response from server - {}'.format(
resp))
print(resp['id'])
elif http_code == 204:
resp))
print(resp['id'])
elif http_code == 204:
@@
-110,13
+110,13
@@
class Project(object):
elif resp and 'result' in resp:
print('Deleted')
else:
elif resp and 'result' in resp:
print('Deleted')
else:
- msg = ""
- if resp:
- try:
- msg = json.loads(resp)
- except ValueError:
- msg = resp
- raise
OsmHttp
Exception("failed to delete project {} - {}".format(name, msg))
+ msg =
resp or
""
+
#
if resp:
+
#
try:
+
#
msg = json.loads(resp)
+
#
except ValueError:
+
#
msg = resp
+ raise
Client
Exception("failed to delete project {} - {}".format(name, msg))
def list(self, filter=None):
"""Returns the list of OSM projects
def list(self, filter=None):
"""Returns the list of OSM projects