1
0
Fork 0

Add error logging to WS errors.

This commit is contained in:
Nicolas Perriault 2017-04-25 17:27:21 +02:00
parent b0c6bc0240
commit a2e4014b56
No known key found for this signature in database
GPG Key ID: DA5E4C83904F7A2A
1 changed files with 19 additions and 15 deletions

View File

@ -540,25 +540,29 @@ update msg model =
{ model | notifications = [], errors = (errorText error) :: model.errors } ! []
NewWebsocketUserMessage message ->
case (Mastodon.decodeWebSocketMessage message) of
Mastodon.EventError error ->
{ model | errors = error :: model.errors } ! []
let
logError label error message =
Debug.log (label ++ " WS error: " ++ error) message
in
case (Mastodon.decodeWebSocketMessage message) of
Mastodon.EventError error ->
{ model | errors = (logError "EventError" error message) :: model.errors } ! []
Mastodon.NotificationResult result ->
case result of
Ok notification ->
{ model | notifications = Mastodon.addNotificationToAggregates notification model.notifications } ! []
Mastodon.NotificationResult result ->
case result of
Ok notification ->
{ model | notifications = Mastodon.addNotificationToAggregates notification model.notifications } ! []
Err error ->
{ model | errors = error :: model.errors } ! []
Err error ->
{ model | errors = (logError "NotificationResult" error message) :: model.errors } ! []
Mastodon.StatusResult result ->
case result of
Ok status ->
{ model | userTimeline = status :: model.userTimeline } ! []
Mastodon.StatusResult result ->
case result of
Ok status ->
{ model | userTimeline = status :: model.userTimeline } ! []
Err error ->
{ model | errors = error :: model.errors } ! []
Err error ->
{ model | errors = (logError "StatusResult" error message) :: model.errors } ! []
NewWebsocketLocalMessage message ->
-- @TODO