-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move remaining IdentityError types to method-specific errors (
#3383) Move the remaining enumerated types in IdentityError to method-specific error types, and remove IdentityError. New types: - CallSenderFromWalletError - RequireIdentityExistsError - UseIdentityByNameError - WriteDefaultIdentityError
- Loading branch information
1 parent
2b7f4f1
commit b24cc40
Showing
14 changed files
with
87 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use candid::types::principal::PrincipalError; | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum CallSenderFromWalletError { | ||
#[error("Failed to read principal from id '{0}': {1}")] | ||
ParsePrincipalFromIdFailed(String, PrincipalError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/dfx-core/src/error/identity/require_identity_exists.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use std::path::PathBuf; | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum RequireIdentityExistsError { | ||
#[error("Identity {0} does not exist at '{1}'.")] | ||
IdentityDoesNotExist(String, PathBuf), | ||
|
||
#[error("An Identity named {0} cannot be created as it is reserved for internal use.")] | ||
ReservedIdentityName(String), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::error::identity::require_identity_exists::RequireIdentityExistsError; | ||
use crate::error::identity::write_default_identity::WriteDefaultIdentityError; | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum UseIdentityByNameError { | ||
#[error("Identity must exist: {0}")] | ||
RequireIdentityExistsFailed(RequireIdentityExistsError), | ||
|
||
#[error("Failed to write default identity: {0}")] | ||
WriteDefaultIdentityFailed(WriteDefaultIdentityError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use crate::error::structured_file::StructuredFileError; | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum WriteDefaultIdentityError { | ||
#[error("Failed to save identity manager configuration: {0}")] | ||
SaveIdentityManagerConfigurationFailed(StructuredFileError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters