changeset 1836:fb94f92dc740

core (params): return given profile for ProfileUnknownError
author Goffi <goffi@goffi.org>
date Mon, 25 Jan 2016 17:03:45 +0100
parents 5b8a859d5bb4
children 7a8a19e4fa6c
files src/memory/params.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/memory/params.py	Sun Jan 24 18:28:08 2016 +0100
+++ b/src/memory/params.py	Mon Jan 25 17:03:45 2016 +0100
@@ -190,7 +190,7 @@
         """
         if not self.storage.hasProfile(profile):
             log.info(_('Trying to delete an unknown profile'))
-            return defer.fail(Failure(exceptions.ProfileUnknownError))
+            return defer.fail(Failure(exceptions.ProfileUnknownError(profile)))
         if self.host.isConnected(profile):
             if force:
                 self.host.disconnect(profile)
@@ -218,7 +218,7 @@
                     default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0]
                 except IndexError:
                     log.info(_('No profile exist yet'))
-                    raise exceptions.ProfileUnknownError
+                    raise exceptions.ProfileUnknownError(profile_key)
             return default  # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
         elif profile_key == C.PROF_KEY_NONE:
             raise exceptions.ProfileNotSetError
@@ -226,7 +226,7 @@
             return profile_key # this value must be managed by the caller
         if not self.storage.hasProfile(profile_key):
             log.error(_(u'Trying to access an unknown profile (%s)') % profile_key)
-            raise exceptions.ProfileUnknownError
+            raise exceptions.ProfileUnknownError(profile_key)
         return profile_key
 
     def __get_unique_node(self, parent, tag, name):
@@ -435,7 +435,7 @@
         if ((param_cat, param_name) == C.PROFILE_PASS_PATH) or not value:
             return defer.succeed(value)  # profile password and empty passwords are returned "as is"
         if not profile:
-            raise exceptions.ProfileUnknownError('The profile is needed to decrypt a password')
+            raise exceptions.ProfileNotSetError('The profile is needed to decrypt a password')
         d = self.host.memory.decryptValue(value, profile)
 
         def gotPlainPassword(password):
@@ -491,7 +491,7 @@
         profile = self.getProfileName(profile_key)
         if not profile:
             log.error(_('Requesting a param for an non-existant profile'))
-            raise exceptions.ProfileUnknownError
+            raise exceptions.ProfileUnknownError(profile_key)
 
         if profile not in self.params:
             log.error(_('Requesting synchronous param for not connected profile'))
@@ -814,7 +814,7 @@
             profile = self.getProfileName(profile_key)
             if not profile:
                 log.error(_(u'Trying to set parameter for an unknown profile'))
-                raise exceptions.ProfileUnknownError
+                raise exceptions.ProfileUnknownError(profile_key)
 
         node = self._getParamNode(name, category, '@ALL@')
         if not node: