mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-23 20:52:04 +00:00
[13.0]try/except in init3
This commit is contained in:
parent
fbb9a0034e
commit
f097880a32
@ -379,6 +379,7 @@ class EbicsUserID(models.Model):
|
|||||||
if self.state != 'get_bank_keys':
|
if self.state != 'get_bank_keys':
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_("Set state to 'Get Keys from Bank'."))
|
_("Set state to 'Get Keys from Bank'."))
|
||||||
|
try:
|
||||||
keyring = EbicsKeyRing(
|
keyring = EbicsKeyRing(
|
||||||
keys=self.ebics_keys_fn, passphrase=self.ebics_passphrase)
|
keys=self.ebics_keys_fn, passphrase=self.ebics_passphrase)
|
||||||
bank = EbicsBank(
|
bank = EbicsBank(
|
||||||
@ -391,8 +392,26 @@ class EbicsUserID(models.Model):
|
|||||||
userid=self.name)
|
userid=self.name)
|
||||||
client = EbicsClient(
|
client = EbicsClient(
|
||||||
bank, user, version=self.ebics_config_id.ebics_version)
|
bank, user, version=self.ebics_config_id.ebics_version)
|
||||||
|
except Exception:
|
||||||
|
exctype, value = exc_info()[:2]
|
||||||
|
error = _("EBICS Initialisation Error:")
|
||||||
|
error += '\n' + str(exctype) + '\n' + str(value)
|
||||||
|
raise UserError(error)
|
||||||
|
|
||||||
|
try:
|
||||||
public_bank_keys = client.HPB()
|
public_bank_keys = client.HPB()
|
||||||
|
except EbicsFunctionalError:
|
||||||
|
e = exc_info()
|
||||||
|
error = _("EBICS Functional Error:")
|
||||||
|
error += '\n'
|
||||||
|
error += '%s (code: %s)' % (e[1].message, e[1].code)
|
||||||
|
raise UserError(error)
|
||||||
|
except Exception:
|
||||||
|
exctype, value = exc_info()[:2]
|
||||||
|
error = _("EBICS Initialisation Error:")
|
||||||
|
error += '\n' + str(exctype) + '\n' + str(value)
|
||||||
|
raise UserError(error)
|
||||||
|
|
||||||
public_bank_keys = public_bank_keys.encode()
|
public_bank_keys = public_bank_keys.encode()
|
||||||
tmp_dir = os.path.normpath(self.ebics_config_id.ebics_files + '/tmp')
|
tmp_dir = os.path.normpath(self.ebics_config_id.ebics_files + '/tmp')
|
||||||
if not os.path.isdir(tmp_dir):
|
if not os.path.isdir(tmp_dir):
|
||||||
|
Loading…
Reference in New Issue
Block a user