Trifolium.API.parse_response
You're seeing just the function
parse_response
, go back to Trifolium.API module for more information.
Link to this function
parse_response(arg)
Specs
Parse a response returned by Trefle API in a JSON, in a correct fashion, according to the status_code returned
If the status_code
field from the request is 200 or 201, returns {:ok, %{}}
.
If the status_code
field from the request is 404, returns {:error, 404, %{message: message}
where message
is the returned value from Trefle.
If any status other than 200 or 404 is returned on status_code
we return {:error, status, message}
where :status is the status_code
returned, and you
hould handle the error yourself. The message
part of the tuple is the body
returned by the request.