catching WrongIdError

This commit is contained in:
Arvind Tiwari 2017-09-15 18:15:06 +05:30
parent 9c0cefd419
commit d49e90bd20
1 changed files with 4 additions and 1 deletions

View File

@ -972,10 +972,13 @@ class VirtualMachineView(LoginRequiredMixin, View):
for t in range(15):
try:
manager.get_vm(self.kwargs.get('pk'))
except BaseException:
except WrongIdError:
response['status'] = True
response['redirect'] = self.get_success_url()
response['text'] = ugettext('Terminated')
self.send_mail()
break
except BaseException:
break
else:
sleep(2)