Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split errors in Tool check #33

Closed
chshersh opened this issue Jun 25, 2022 · 0 comments
Closed

Split errors in Tool check #33

chshersh opened this issue Jun 25, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@chshersh
Copy link
Owner

Currently, the checkTool function has the following type:

checkTool :: cmd -> Tool cmd -> IO ToolCheckResult

where ToolCheckResult is defined as follows:

data ToolCheckResult
    = ToolNotFound Text
    | ToolWrongVersion Text
    | ToolOk

A value of ToolCheckResult is thrown as an exception here:

iris/src/Iris/Env.hs

Lines 138 to 141 in 6be65d4

for_ cliEnvSettingsRequiredTools $ \tool ->
checkTool cmd tool >>= \case
ToolOk -> pure ()
toolErr -> throwIO $ CliEnvException $ CliEnvToolError toolErr

This is suboptimal because the result can never have the ToolOk constructors but we're forcing downstream users to handle this case.

So we want to split success and error cases in the ToolCheckResult type.

@chshersh chshersh added the enhancement New feature or request label Jun 25, 2022
@chshersh chshersh added the good first issue Good for newcomers label Aug 8, 2022
@charrsky charrsky self-assigned this Aug 19, 2022
charrsky added a commit that referenced this issue Aug 21, 2022
@chshersh chshersh added this to the v0.1.0.0: Improved UX milestone Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants