@@ -1027,25 +1027,40 @@ def _before_command(self):
10271027 def _task_complete (self , task ):
10281028 return [str (path ) for path in self .paths ]
10291029
1030+ @property
1031+ @abstractmethod
1032+ def _error_object (self ):
1033+ raise NotImplementedError ('Subclass must implement the "_error_object" property.' )
1034+
1035+ def _task_error (self , task ):
1036+ cursor = task .cursor
1037+ error = self ._error_object (self .paths , cursor )
1038+
1039+ if task .error_type == ResourceError .PermissionDenied :
1040+ resource = automatic_resolution (cursor ).relative
1041+ raise error from exceptions .io .core .PrivilegeError (resource )
1042+
1043+ raise error
1044+
10301045
10311046class Delete (MultiResourceCommand ):
10321047
10331048 def _progress_str (self ):
10341049 return 'Deleting'
10351050
1036- def _task_error ( self , task ):
1037- cursor = task . cursor
1038- raise exceptions .io .core .DeleteError ( self . paths , cursor )
1051+ @ property
1052+ def _error_object ( self ):
1053+ return exceptions .io .core .DeleteError
10391054
10401055
10411056class Recover (MultiResourceCommand ):
10421057
10431058 def _progress_str (self ):
10441059 return 'Recovering'
10451060
1046- def _task_error ( self , task ):
1047- cursor = task . cursor
1048- raise exceptions .io .core .RecoverError ( self . paths , cursor )
1061+ @ property
1062+ def _error_object ( self ):
1063+ return exceptions .io .core .RecoverError
10491064
10501065
10511066class ResolverCommand (TaskCommand ):
@@ -1132,7 +1147,7 @@ def _task_error(self, task):
11321147 )
11331148 raise error from exceptions .io .core .FolderNotFoundError (directory .relative )
11341149
1135- raise self . _error_object ( self . paths , cursor )
1150+ raise error
11361151
11371152
11381153class Copy (ResolverCommand ):
0 commit comments