From da6e7d7313dacdc9d3ad79daf83ed52bd63156e2 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Tue, 28 Jun 2022 14:48:57 -0700 Subject: [PATCH] Remove some Debug statements. --- examples/docs/app/Effect.elm | 8 ++++++ .../src/generate-template-module-connector.js | 3 -- src/Pages/FormState.elm | 2 +- src/Pages/Internal/Platform.elm | 28 +++++++++++++++---- src/Pages/Internal/Platform/Cli.elm | 3 -- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/examples/docs/app/Effect.elm b/examples/docs/app/Effect.elm index 6383d1cb..f98e1acc 100644 --- a/examples/docs/app/Effect.elm +++ b/examples/docs/app/Effect.elm @@ -15,6 +15,7 @@ type Effect msg | Cmd (Cmd msg) | Batch (List (Effect msg)) | GetStargazers (Result Http.Error Int -> msg) + | SetField { formId : String, name : String, value : String } | FetchRouteData { data : Maybe FormDecoder.FormData , toMsg : Result Http.Error Url -> msg @@ -74,6 +75,9 @@ map fn effect = , toMsg = fetchInfo.toMsg >> fn } + SetField info -> + SetField info + SubmitFetcher fetcher -> fetcher |> Pages.Fetcher.map fn @@ -96,6 +100,7 @@ perform : -> Cmd msg , fromPageMsg : pageMsg -> msg , key : Browser.Navigation.Key + , setField : { formId : String, name : String, value : String } -> Cmd msg } -> Effect pageMsg -> Cmd msg @@ -107,6 +112,9 @@ perform ({ fromPageMsg, key } as helpers) effect = Cmd cmd -> Cmd.map fromPageMsg cmd + SetField info -> + helpers.setField info + Batch list -> Cmd.batch (List.map (perform helpers) list) diff --git a/generator/src/generate-template-module-connector.js b/generator/src/generate-template-module-connector.js index affc53b4..d8f8ee9e 100644 --- a/generator/src/generate-template-module-connector.js +++ b/generator/src/generate-template-module-connector.js @@ -615,9 +615,6 @@ config = } onActionData actionData = - let - _ = Debug.log "onActionData" actionData - in case actionData of ${templates .map( diff --git a/src/Pages/FormState.elm b/src/Pages/FormState.elm index 42690b53..299a3ed4 100644 --- a/src/Pages/FormState.elm +++ b/src/Pages/FormState.elm @@ -93,7 +93,7 @@ update eventObject pageFormState = -- pageFormState -- --else - case eventObject |> Decode.decodeValue fieldEventDecoder |> Debug.log "fieldEvent" of + case eventObject |> Decode.decodeValue fieldEventDecoder of Ok fieldEvent -> pageFormState |> Dict.update fieldEvent.formId diff --git a/src/Pages/Internal/Platform.elm b/src/Pages/Internal/Platform.elm index f61371e4..b006814e 100644 --- a/src/Pages/Internal/Platform.elm +++ b/src/Pages/Internal/Platform.elm @@ -835,8 +835,17 @@ startFetcher options model = |> Just |> Ok - _ -> - Debug.todo "" + Http.BadUrl_ string -> + Err <| Http.BadUrl string + + Http.Timeout_ -> + Err <| Http.Timeout + + Http.NetworkError_ -> + Err <| Http.NetworkError + + Http.BadStatus_ metadata body -> + Err <| Http.BadStatus metadata.statusCode ) , tracker = Nothing , body = Http.stringBody "application/x-www-form-urlencoded" encodedBody @@ -867,10 +876,17 @@ startFetcher2 formData model = -- TODO maybe have an optional way to pass the bytes through? Ok Nothing - _ -> - -- TODO where should errors go in application state? Should there be an onError where you can receive application-managed error events that are owned by - -- the Platform Model/Msg's? - Debug.todo "" + Http.BadUrl_ string -> + Err <| Http.BadUrl string + + Http.Timeout_ -> + Err <| Http.Timeout + + Http.NetworkError_ -> + Err <| Http.NetworkError + + Http.BadStatus_ metadata body -> + Err <| Http.BadStatus metadata.statusCode ) , tracker = Nothing diff --git a/src/Pages/Internal/Platform/Cli.elm b/src/Pages/Internal/Platform/Cli.elm index f9603f3b..53ad0c20 100644 --- a/src/Pages/Internal/Platform/Cli.elm +++ b/src/Pages/Internal/Platform/Cli.elm @@ -647,7 +647,6 @@ nextStepToEffect site config model ( updatedStaticResponsesModel, nextStep ) = config.sharedData model.allRawResponses |> Result.mapError (StaticHttpRequest.toBuildError "") - |> Debug.log "@@@sharedData" apiResponse : Effect apiResponse = @@ -772,7 +771,6 @@ sendSinglePageProgress site contentJson config model info = case includeHtml of RenderRequest.OnlyJson -> pageDataResult - |> Debug.log "pageDataResult" |> Result.map (\okPageData -> case okPageData of @@ -896,7 +894,6 @@ sendSinglePageProgress site contentJson config model info = } ) - --Debug.todo "" currentUrl : Url currentUrl = { protocol = Url.Https