core (params): return given profile for ProfileUnknownError

This commit is contained in:
Goffi 2016-01-25 17:03:45 +01:00
commit d7bca38b31

View file

@ -190,7 +190,7 @@ class Params(object):
"""
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 @@ class Params(object):
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 @@ class Params(object):
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 @@ class Params(object):
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 @@ class Params(object):
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 @@ class Params(object):
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: