Skip to content

Commit

Permalink
Better error if template does not exist
Browse files Browse the repository at this point in the history
PermissionDenied results in an unhelpful "Got empty response from
qubesd" error.

(cherry picked from commit 6f16f26)
  • Loading branch information
DemiMarie authored and marmarek committed Jan 20, 2024
1 parent 095a8ef commit b3af89f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions qubes/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,7 @@ async def _vm_create(self, vm_type, allow_pool=False,
if self.arg:
if hasattr(vm_class, 'template'):
if self.arg not in self.app.domains:
raise qubes.api.PermissionDenied(
'Template {} does not exist'.format(self.arg))
raise qubes.exc.QubesVMNotFoundError(self.arg)
kwargs['template'] = self.app.domains[self.arg]
else:
raise qubes.exc.QubesValueError(
Expand Down

0 comments on commit b3af89f

Please sign in to comment.