on master help sign in
command: Improve error reporting
commit1040ff1cacf86cc9b2e549c30bfed4b28c654ed5 authorElliot Cameron <eacameron@gmail.com> dateWed 8 Apr 2020, 15:41 (7 years ago) parent6a8bcee
1 file changed+3−3
lib/command/src/Obelisk/Command/Thunk.hs+3−3
lib/command/src/Obelisk/Command/Thunk.hs+3−3
@@ -450,7 +450,7 @@ updateThunkToLatest (ThunkUpdateConfig mBranch thunkConfig) target = spinner $ d
450450 case mBranch of
451451 Nothing -> do
452452 (overwrite, ptr) <- readThunk target >>= \case
453− Left err -> failWith $ T.pack $ "thunk update: " <> show err
453+ Left err -> failWith [i|Thunk update: ${err}|]
454454 Right c -> case c of
455455 ThunkData_Packed _ t -> return (target, t)
456456 ThunkData_Checkout -> failWith "cannot update an unpacked thunk"
@@ -461,14 +461,14 @@ updateThunkToLatest (ThunkUpdateConfig mBranch thunkConfig) target = spinner $ d
461461 , _thunkPtr_rev = rev
462462 }
463463 Just branch -> readThunk target >>= \case
464− Left err -> failWith $ T.pack $ "thunk update: " <> show err
464+ Left err -> failWith [i|Thunk update: ${err}|]
465465 Right c -> case c of
466466 ThunkData_Packed _ t -> case _thunkPtr_source t of
467467 ThunkSource_Git tsg -> setThunk thunkConfig target tsg branch
468468 ThunkSource_GitHub tsgh -> do
469469 let tsg = forgetGithub False tsgh
470470 setThunk thunkConfig target tsg branch
471− ThunkData_Checkout -> failWith $ T.pack $ "thunk located at " <> show target <> " is unpacked. Use ob thunk pack on the desired directory and then try ob thunk update again."
471+ ThunkData_Checkout -> failWith [i|Thunk located at ${target} is unpacked. Use 'ob thunk pack' on the desired directory and then try 'ob thunk update' again.|]
472472 where
473473 spinner = withSpinner' ("Updating thunk " <> T.pack target <> " to latest") (pure $ const $ "Thunk " <> T.pack target <> " updated to latest")
474474