-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
81 additions
and
27 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
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 |
---|---|---|
@@ -1,8 +1,32 @@ | ||
module Confer.CLI.Errors where | ||
|
||
import Data.Text (Text) | ||
import Data.Text qualified as Text | ||
import Data.Text.Display | ||
import System.Exit qualified as System | ||
import System.OsPath (OsPath) | ||
import System.OsPath qualified as OsPath | ||
|
||
import Confer.Config.Types | ||
|
||
data CLIError | ||
= NoDefaultConfigurationFile | ||
| NoUserProvidedConfigurationFile OsPath | ||
| NoDeploymentsAvailable DeploymentOS DeploymentArchitecture Text | ||
deriving stock (Eq, Show) | ||
|
||
reportError :: CLIError -> IO () | ||
reportError NoDefaultConfigurationFile = | ||
System.die "[!] Could not find configuration file at ./deployments.lua" | ||
reportError (NoUserProvidedConfigurationFile osPath) = do | ||
filePath <- OsPath.decodeFS osPath | ||
System.die $ "[!] Could not find configuration file at" <> filePath | ||
reportError (NoDeploymentsAvailable os arch hostname) = do | ||
let message = | ||
"[!] Could not find deployments to run on " | ||
<> display arch | ||
<> "-" | ||
<> display os | ||
<> " " | ||
<> hostname | ||
System.die $ Text.unpack message |
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