Skip to content

Commit 14cb7e0

Browse files
committed
Print errors.
1 parent bd8e2dc commit 14cb7e0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

streams/src/Main.gren

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,29 @@ init env =
119119
update : Msg -> Model -> { model : Model, command : Cmd Msg }
120120
update msg model =
121121
case msg of
122-
Exit _ ->
122+
Exit (Err err) ->
123+
{ model = model
124+
, command =
125+
Stream.writeLineAsBytes ("Failed Exit with error: " ++ Debug.toString err) model.stdout
126+
|> Task.attempt Exit
127+
}
128+
129+
Exit (Ok _) ->
123130
{ model = model
124131
, command =
125132
-- Something special when dealing with CLET, so reading from stdin seems to
126133
-- prevent node from closing. Solving this by closing manually.
127134
Node.exit |> Task.execute
128135
}
129136

130-
ExitAfterPipe result ->
137+
ExitAfterPipe (Err err) ->
138+
{ model = model
139+
, command =
140+
Stream.writeLineAsBytes ("Failed ExitAfterPipe with error: " ++ Debug.toString err) model.stdout
141+
|> Task.attempt Exit
142+
}
143+
144+
ExitAfterPipe (Ok _) ->
131145
{ model = model
132146
, command =
133147
Node.exit |> Task.execute

0 commit comments

Comments
 (0)