Skip to content

Commit

Permalink
Print errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinheghan committed Dec 2, 2024
1 parent bd8e2dc commit 14cb7e0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions streams/src/Main.gren
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,29 @@ init env =
update : Msg -> Model -> { model : Model, command : Cmd Msg }
update msg model =
case msg of
Exit _ ->
Exit (Err err) ->
{ model = model
, command =
Stream.writeLineAsBytes ("Failed Exit with error: " ++ Debug.toString err) model.stdout
|> Task.attempt Exit
}

Exit (Ok _) ->
{ model = model
, command =
-- Something special when dealing with CLET, so reading from stdin seems to
-- prevent node from closing. Solving this by closing manually.
Node.exit |> Task.execute
}

ExitAfterPipe result ->
ExitAfterPipe (Err err) ->
{ model = model
, command =
Stream.writeLineAsBytes ("Failed ExitAfterPipe with error: " ++ Debug.toString err) model.stdout
|> Task.attempt Exit
}

ExitAfterPipe (Ok _) ->
{ model = model
, command =
Node.exit |> Task.execute
Expand Down

0 comments on commit 14cb7e0

Please sign in to comment.