@@ -16,6 +16,8 @@ newtype AppError = AppError Text
17instance Exception AppError
17instance Exception AppError
19+-- TODO: When printing warnings and such, the spinner should let them be printed
20+-- in new line (above the spinner)
19withSpinner
21withSpinner
20 :: String -- ^ Text to print alongside the spinner
22 :: String -- ^ Text to print alongside the spinner
21 -> Maybe String -- ^ Optional text to print at the end
23 -> Maybe String -- ^ Optional text to print at the end
@@ -40,12 +42,10 @@ withSpinner s e f = do
41data Level = Level_Normal | Level_Warning | Level_Error
43data Level = Level_Normal | Level_Warning | Level_Error
43−runCLI :: IO () -> IO ()
44−runCLI = handle $ \(AppError err) -> putError err
46-- | Prefer this over the alternative ways to exit the program with an error message as it automatically
45-- | Prefer this over the alternative ways to exit the program with an error message as it automatically
47-- takes care of cleaning on spinners.
46-- takes care of cleaning on spinners.
48-- TODO: Replace the uses of 'fail' throughout Stela to use this function.
47-- TODO: Replace the uses of 'fail' throughout Stela to use this function.
48+-- TODO: Handle this error cleanly when evaluating outside of `withSpinner` (eg: runCLI)
49putErrorAndExit :: Text -> IO ()
49putErrorAndExit :: Text -> IO ()
50putErrorAndExit = throw . AppError
50putErrorAndExit = throw . AppError