Print alternative day if day not found

This commit is contained in:
2023-05-14 21:34:50 +08:00
parent 210816769a
commit aed478153d
3 changed files with 21 additions and 6 deletions

View File

@@ -724,7 +724,9 @@ fromVersion' (SetToolTag Latest) tool = do
bimap mkTVer Just <$> getLatest dls tool ?? TagNotFound Latest tool
fromVersion' (SetToolDay day) tool = do
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
bimap mkTVer Just <$> getByReleaseDay dls tool day ?? DayNotFound day tool
bimap mkTVer Just <$> case getByReleaseDay dls tool day of
Left ad -> throwE $ DayNotFound day tool ad
Right v -> pure v
fromVersion' (SetToolTag LatestPrerelease) tool = do
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
bimap mkTVer Just <$> getLatestPrerelease dls tool ?? TagNotFound LatestPrerelease tool