Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
clive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
clive
Commits
afdc12a1
Commit
afdc12a1
authored
2 weeks ago
by
Marcin Sobczyk
Browse files
Options
Downloads
Patches
Plain Diff
Display meaningful notofication when save profile fails
parent
3ba929a1
No related branches found
No related tags found
2 merge requests
!600
v1.27.5.21 Release
,
!593
msobczyk/371 change moment of saving changes to profile
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
clive/__private/core/commands/save_profile.py
+16
-3
16 additions, 3 deletions
clive/__private/core/commands/save_profile.py
clive/__private/core/error_handlers/general_error_notificator.py
+2
-0
2 additions, 0 deletions
..._private/core/error_handlers/general_error_notificator.py
with
18 additions
and
3 deletions
clive/__private/core/commands/save_profile.py
+
16
−
3
View file @
afdc12a1
from
__future__
import
annotations
from
__future__
import
annotations
from
dataclasses
import
dataclass
from
dataclasses
import
dataclass
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
,
Final
from
clive.__private.core.commands.abc.command
import
Command
from
beekeepy.exceptions
import
CommunicationError
from
clive.__private.core.beekeeper_manager
import
WalletsNotAvailableError
from
clive.__private.core.commands.abc.command
import
Command
,
CommandError
from
clive.__private.core.commands.abc.command_encryption
import
CommandEncryption
from
clive.__private.core.commands.abc.command_encryption
import
CommandEncryption
from
clive.__private.core.encryption
import
EncryptionService
from
clive.__private.core.encryption
import
EncryptionService
from
clive.__private.core.wallet_container
import
WalletContainer
from
clive.__private.core.wallet_container
import
WalletContainer
...
@@ -12,6 +15,13 @@ if TYPE_CHECKING:
...
@@ -12,6 +15,13 @@ if TYPE_CHECKING:
from
clive.__private.core.profile
import
Profile
from
clive.__private.core.profile
import
Profile
class
ProfileSavingFailedError
(
CommandError
):
MESSAGE
:
Final
[
str
]
=
"
Profile saving failed because beekeeper is not available.
"
def
__init__
(
self
,
command
:
Command
)
->
None
:
super
().
__init__
(
command
,
self
.
MESSAGE
)
@dataclass
(
kw_only
=
True
)
@dataclass
(
kw_only
=
True
)
class
SaveProfile
(
CommandEncryption
,
Command
):
class
SaveProfile
(
CommandEncryption
,
Command
):
profile
:
Profile
profile
:
Profile
...
@@ -22,4 +32,7 @@ class SaveProfile(CommandEncryption, Command):
...
@@ -22,4 +32,7 @@ class SaveProfile(CommandEncryption, Command):
async
def
_execute
(
self
)
->
None
:
async
def
_execute
(
self
)
->
None
:
encryption_service
=
EncryptionService
(
WalletContainer
(
self
.
unlocked_wallet
,
self
.
unlocked_encryption_wallet
))
encryption_service
=
EncryptionService
(
WalletContainer
(
self
.
unlocked_wallet
,
self
.
unlocked_encryption_wallet
))
await
self
.
profile
.
save
(
encryption_service
)
try
:
await
self
.
profile
.
save
(
encryption_service
)
except
(
CommunicationError
,
WalletsNotAvailableError
)
as
error
:
raise
ProfileSavingFailedError
(
self
)
from
error
This diff is collapsed.
Click to expand it.
clive/__private/core/error_handlers/general_error_notificator.py
+
2
−
0
View file @
afdc12a1
...
@@ -5,6 +5,7 @@ from typing import Final, TypeGuard
...
@@ -5,6 +5,7 @@ from typing import Final, TypeGuard
from
beekeepy.exceptions
import
InvalidPasswordError
,
NotExistingKeyError
,
NoWalletWithSuchNameError
from
beekeepy.exceptions
import
InvalidPasswordError
,
NotExistingKeyError
,
NoWalletWithSuchNameError
from
clive.__private.core.commands.recover_wallets
import
CannotRecoverWalletsError
from
clive.__private.core.commands.recover_wallets
import
CannotRecoverWalletsError
from
clive.__private.core.commands.save_profile
import
ProfileSavingFailedError
from
clive.__private.core.error_handlers.abc.error_notificator
import
ErrorNotificator
from
clive.__private.core.error_handlers.abc.error_notificator
import
ErrorNotificator
from
clive.__private.storage.service
import
ProfileEncryptionError
from
clive.__private.storage.service
import
ProfileEncryptionError
...
@@ -18,6 +19,7 @@ class GeneralErrorNotificator(ErrorNotificator[Exception]):
...
@@ -18,6 +19,7 @@ class GeneralErrorNotificator(ErrorNotificator[Exception]):
NotExistingKeyError
:
"
Key does not exist in the wallet.
"
,
NotExistingKeyError
:
"
Key does not exist in the wallet.
"
,
ProfileEncryptionError
:
"
Profile encryption failed which means profile cannot be saved or loaded.
"
,
ProfileEncryptionError
:
"
Profile encryption failed which means profile cannot be saved or loaded.
"
,
CannotRecoverWalletsError
:
CannotRecoverWalletsError
.
MESSAGE
,
CannotRecoverWalletsError
:
CannotRecoverWalletsError
.
MESSAGE
,
ProfileSavingFailedError
:
ProfileSavingFailedError
.
MESSAGE
,
}
}
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment