Skip to content

Commit

Permalink
add try catch around get image
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Glatthard committed Aug 10, 2015
1 parent 18bc26c commit 318d293
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ipynbsrv/web/views/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def clone(request):
new_name = "{}_clone".format(container.name)

# create clone
client.containers(ct_id).clone.post({"name": new_name})
try:
client.containers(ct_id).clone.post({"name": new_name})
messages.success(request, "Sucessfully created the clone `{}`.".format(new_name))
except Exception as e:
messages.error(request, api_error_message(e, params))

return redirect('containers')

Expand Down Expand Up @@ -96,6 +100,8 @@ def create(request):
image = client.containers.images(params.get('image_id')).get()
except HttpNotFoundError:
messages.error(request, "Container bootstrap image does not exist or you don't have enough permissions for the requested operation.")
except Exception as ex:
messages.error(request, api_error_message(ex, params))

if image:
try:
Expand Down

0 comments on commit 318d293

Please sign in to comment.