Throw an error when connection can’t be established.
Return an error when JSON can’t be parsed.