@@ -1813,7 +1813,7 @@ async def vm_device_set_required(self, endpoint, untrusted_payload):
18131813 try :
18141814 mode = allowed_values [untrusted_payload ]
18151815 except KeyError :
1816- raise qubes .exc .ProtocolError ("Invalid assignment mode" )
1816+ raise qubes .exc .QubesUnrecognizedDeviceAssignmentMode ("Invalid assignment mode" )
18171817
18181818 dev = VirtualDevice .from_qarg (self .arg , devclass , self .app .domains )
18191819
@@ -2096,9 +2096,7 @@ async def backup_execute(self):
20962096 qubes .config .backup_profile_dir , self .arg + ".conf"
20972097 )
20982098 if not os .path .exists (profile_path ):
2099- raise qubes .exc .ProtocolError (
2100- "Backup profile does not exist: {}" .format (self .arg )
2101- )
2099+ raise qubes .exc .QubesBackupProfileNotFoundError (profile = self .arg )
21022100
21032101 if not hasattr (self .app , "api_admin_running_backups" ):
21042102 self .app .api_admin_running_backups = {}
@@ -2117,7 +2115,7 @@ async def backup_execute(self):
21172115 try :
21182116 await backup_task
21192117 except asyncio .CancelledError :
2120- raise qubes .exc .QubesException ( "Backup cancelled" )
2118+ raise qubes .exc .BackupCancelledError ( )
21212119 finally :
21222120 del self .app .api_admin_running_backups [self .arg ]
21232121
@@ -2159,9 +2157,7 @@ async def backup_info(self):
21592157 qubes .config .backup_profile_dir , self .arg + ".conf"
21602158 )
21612159 if not os .path .exists (profile_path ):
2162- raise qubes .exc .ProtocolError (
2163- "Backup profile does not exist: {}" .format (self .arg )
2164- )
2160+ raise qubes .exc .QubesBackupProfileNotFoundError (profile = self .arg )
21652161
21662162 backup = await self ._load_backup_profile (self .arg , skip_passphrase = True )
21672163 return backup .get_backup_summary ()
0 commit comments