@@ -280,12 +280,12 @@ alterRouteTo uri stdout = do
280280
281281-- | Handle stdout of `ob run`: check that the frontend and backend servers are started correctly
282282handleObRunStdout :: HTTP.Manager -> Handle -> Sh Text
283−handleObRunStdout httpManager stdout = flip fix ObRunState_Init $ \loop state -> do
283+handleObRunStdout httpManager stdout = flip fix (ObRunState_Init, []) $ \loop (state, msgs) -> do
284284 liftIO (T.hGetLine stdout) >>= \t -> case state of
285285 ObRunState_Init
286− | "Running test..." `T.isPrefixOf` t -> loop ObRunState_BackendStarted
286+ | "Running test..." `T.isPrefixOf` t -> loop (ObRunState_BackendStarted, msgs)
287287 ObRunState_Startup
288− | t == "backend stopped; make a change to your code to reload" -> loop ObRunState_Startup
288+ | t == "backend stopped; make a change to your code to reload" -> loop (ObRunState_Startup, msgs)
289289 -- | Just port <- "Backend running on port " `T.stripPrefix` t -> loop $ ObRunState_BackendStarted port
290290 | not (T.null t) -> errorExit $ "Startup: " <> t -- If theres any other output here, startup failed
291291 ObRunState_BackendStarted
@@ -293,7 +293,8 @@ handleObRunStdout httpManager stdout = flip fix ObRunState_Init $ \loop state ->
293293 obRunCheck httpManager stdout uri
294294 pure uri
295295 | not (T.null t) -> errorExit $ "Started: " <> t -- If theres any other output here, startup failed
296− _ -> loop state
296+ _ | "Failed" `T.isPrefixOf` t -> errorExit $ "ob run failed: " <> T.unlines (reverse $ t : msgs)
297+ | otherwise -> loop (state, t : msgs)
297298
298299-- | Make requests to frontend/backend servers to check they are working properly
299300obRunCheck :: HTTP.Manager -> Handle -> Text -> Sh ()