#question about lustre_http.expect_json

1 messages · Page 1 of 1 (latest)

drowsy gale
#

expect_json has to_msg: fn(Result(a, HttpError)) -> b parameter. My question is what happens if there is an error decoding json? The Result in that case will have a List(DecodeError) , correct? Will to_msg still be called? Is a Result(a, HttpError) same as Result(a, List(DecodeError)) ?

eager mortar
#

look at the error type

#
pub type HttpError {
  BadUrl(String)
  InternalServerError(String)
  JsonError(json.DecodeError)
  NetworkError
  NotFound
  OtherError(Int, String)
  Unauthorized
}