mirror of
https://github.com/avinal/avinal.github.io.git
synced 2026-07-04 07:40:09 +05:30
239c67da1c
Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
35 lines
855 B
Elm
35 lines
855 B
Elm
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
|