Skip to content

Commit

Permalink
migrating to jsx 3.0, adding fmt command
Browse files Browse the repository at this point in the history
  • Loading branch information
lattenwald committed Sep 14, 2020
1 parent 891c8d6 commit 05e2d1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 4 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
%% -*- mode: erlang -*-

{erl_opts, [debug_info]}.
{deps, [ { jsx, ".*", { git, "https://github.com/talentdeficit/jsx.git", { tag, "v2.9.0" } } }
, { lager, ".*", { git, "https://github.com/erlang-lager/lager.git", { tag, "3.6.4" } } }
{deps, [ { jsx, ".*", { git, "https://github.com/talentdeficit/jsx.git", { tag, "v3.0.0" } } }
, { lager, ".*", { git, "https://github.com/erlang-lager/lager.git", { tag, "3.8.1" } } }
] }.

{ plugins,
[ { rebar3_rust,
{ git, "https://github.com/lattenwald/rebar3_rust.git", {branch, "master"} } } ] }.
{ git, "https://github.com/lattenwald/rebar3_rust.git", {branch, "master"} } }
, erlfmt ] }.

{ provider_hooks,
[ { post, [ {compile, {rust, compile}} ] } ] }.
Expand Down
10 changes: 4 additions & 6 deletions src/tdlib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,13 @@ handle_info({received, {ok, Msg}}, State=#state{extra = Extra, handlers = Handle
Data = jsx:decode(Msg),

{SyncReply, NewExtra} =
case lists:keyfind(<<"@extra">>, 1, Data) of
{_, E} ->
case maps:get(<<"@extra">>, Data, null) of
null -> {null, Extra};
E ->
case maps:take(E, Extra) of
error -> {null, Extra};
Other -> Other
end;

false ->
{null, Extra}
end
end,

lager:debug("Received: ~ts", [Msg]),
Expand Down

0 comments on commit 05e2d1e

Please sign in to comment.