-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move StakeAddressDelegationError StakeAddressRegistrationError and Sh…
…elleyStakeAddressCmdError error types to own modules
- Loading branch information
Showing
8 changed files
with
73 additions
and
54 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
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
27 changes: 27 additions & 0 deletions
27
cardano-cli/src/Cardano/CLI/Types/Errors/ShelleyStakeAddressCmdError.hs
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,27 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
|
||
module Cardano.CLI.Types.Errors.ShelleyStakeAddressCmdError | ||
( ShelleyStakeAddressCmdError(..) | ||
) where | ||
|
||
import Cardano.Api | ||
|
||
import Cardano.CLI.Read | ||
import Cardano.CLI.Types.Errors.StakeAddressDelegationError | ||
import Cardano.CLI.Types.Errors.StakeAddressRegistrationError | ||
|
||
data ShelleyStakeAddressCmdError | ||
= ShelleyStakeAddressCmdReadKeyFileError !(FileError InputDecodeError) | ||
| ShelleyStakeAddressCmdReadScriptFileError !(FileError ScriptDecodeError) | ||
| ShelleyStakeAddressCmdWriteFileError !(FileError ()) | ||
| StakeRegistrationError !StakeAddressRegistrationError | ||
| StakeDelegationError !StakeAddressDelegationError | ||
deriving Show | ||
|
||
instance Error ShelleyStakeAddressCmdError where | ||
displayError = \case | ||
ShelleyStakeAddressCmdReadKeyFileError fileErr -> displayError fileErr | ||
ShelleyStakeAddressCmdWriteFileError fileErr -> displayError fileErr | ||
ShelleyStakeAddressCmdReadScriptFileError fileErr -> displayError fileErr | ||
StakeRegistrationError regErr -> displayError regErr | ||
StakeDelegationError delegErr -> displayError delegErr |
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
cardano-cli/src/Cardano/CLI/Types/Errors/StakeAddressDelegationError.hs
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,21 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
|
||
module Cardano.CLI.Types.Errors.StakeAddressDelegationError | ||
( StakeAddressDelegationError(..) | ||
) where | ||
|
||
import Cardano.Api | ||
|
||
import qualified Data.Text as Text | ||
|
||
newtype StakeAddressDelegationError = VoteDelegationNotSupported AnyShelleyToBabbageEra deriving Show | ||
|
||
instance Error StakeAddressDelegationError where | ||
displayError = \case | ||
VoteDelegationNotSupported (AnyShelleyToBabbageEra stbe) -> "Vote delegation not supported in " <> eraTxt stbe <> " era." | ||
where | ||
eraTxt :: forall era. ShelleyToBabbageEra era -> String | ||
eraTxt stbe' = shelleyToBabbageEraConstraints stbe' $ | ||
Text.unpack . renderEra $ AnyCardanoEra (cardanoEra @era) |
14 changes: 14 additions & 0 deletions
14
cardano-cli/src/Cardano/CLI/Types/Errors/StakeAddressRegistrationError.hs
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,14 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
|
||
module Cardano.CLI.Types.Errors.StakeAddressRegistrationError | ||
( StakeAddressRegistrationError(..) | ||
) where | ||
|
||
import Cardano.Api | ||
|
||
data StakeAddressRegistrationError = StakeAddressRegistrationDepositRequired | ||
deriving Show | ||
|
||
instance Error StakeAddressRegistrationError where | ||
displayError = \case | ||
StakeAddressRegistrationDepositRequired -> "Stake address deposit required." |
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