@@ -16,6 +16,8 @@ newtype AppError = AppError Text
1616
1717instance Exception AppError
1818
19+-- TODO: When printing warnings and such, the spinner should let them be printed
20+-- in new line (above the spinner)
1921withSpinner
2022 :: String -- ^ Text to print alongside the spinner
2123 -> Maybe String -- ^ Optional text to print at the end
@@ -40,12 +42,10 @@ withSpinner s e f = do
4042
4143data Level = Level_Normal | Level_Warning | Level_Error
4244
43−runCLI :: IO () -> IO ()
44−runCLI = handle $ \(AppError err) -> putError err
45−
4645-- | Prefer this over the alternative ways to exit the program with an error message as it automatically
4746-- takes care of cleaning on spinners.
4847-- 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)
4949putErrorAndExit :: Text -> IO ()
5050putErrorAndExit = throw . AppError
5151