Skip to content

Commit

Permalink
Fixed bug in user_exists, which was introduced when refactoring
Browse files Browse the repository at this point in the history
check_reponse.
  • Loading branch information
baphled committed Dec 4, 2008
1 parent 5c80a53 commit 88a28b1
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions twitterl.erl
Expand Up @@ -85,7 +85,7 @@ trends() ->
loop_json(List,[H|T]) ->
{_,Json} = H,
[{_,Title},{_,Value}] = Json,
Data = [{binary_to_list(Title),binary_to_list(Value)}|List],
Data = [[binary_to_list(Title),binary_to_list(Value)]|List],
loop_json(Data,T);
loop_json(List,[]) ->
list_to_tuple(List).
Expand Down Expand Up @@ -114,12 +114,16 @@ term(Term) ->
%% If an error message is found then we know that the user doesnt exist.
%%
user_exists(User) ->
{ok,Xml} = get_xml(?UserTimeUrl ++ User ++ ".rss"),
case xmerl_xpath:string("//hash/error/text()", Xml) of
[{xmlText, _, _, _, Error, text}] ->
{false, User++": "++Error};
_ ->
{true, User++": found!"}
case get_xml(?UserTimeUrl ++ User ++ ".rss") of
{error,Error} ->
{error, Error};
{ok, Xml} ->
case xmerl_xpath:string("//hash/error/text()", Xml) of
[{xmlText, _, _, _, Error, text}] ->
{false, User++": "++Error};
_ ->
{true, User++": found!"}
end
end.

%% Retrieves a users followers.
Expand Down

0 comments on commit 88a28b1

Please sign in to comment.