module Utils.Utils exposing (..) import Http exposing (Error(..)) import Utils.Constants exposing (..) contentUrl : { category : String, post : String } -> String contentUrl { category, post } = contentUrlPrefix ++ "posts/" ++ category ++ "/" ++ post ++ ".md" errorToString : Http.Error -> String errorToString error = case error of BadUrl url -> "The URL " ++ url ++ " was invalid" Timeout -> "Unable to reach the server, try again" NetworkError -> "Unable to reach the server, check your network connection" BadStatus 500 -> "The server had a problem, try again later" BadStatus 400 -> "Verify your information and try again" BadStatus _ -> "Unknown error" BadBody errorMessage -> errorMessage