Skip to content

Commit

Permalink
Fix JSON format alert output
Browse files Browse the repository at this point in the history
  • Loading branch information
nickelization committed Mar 10, 2015
1 parent 484f91c commit a646e7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/clique_json_writer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ prepare(Status) ->
prepare_status(alert, Ctx=#context{alert_set=true}) ->
%% TODO: Should we just return an error instead?
throw({error, nested_alert, Ctx});
prepare_status(Term, Ctx=#context{alert_set=true, alert_list=AList}) ->
Ctx#context{alert_list=[Term | AList]};
prepare_status(alert, Ctx) ->
Ctx#context{alert_set=true};
prepare_status(alert_done, Ctx = #context{alert_list=AList, output=Output}) ->
%% AList is already reversed, and prepare returns reversed output, so they cancel out
AlertJsonVal = prepare(AList),
AlertJson = {struct, [{<<"type">>, <<"alert">>}, {<<"alert">>, AlertJsonVal}]},
Ctx#context{alert_set=false, alert_list=[], output=[AlertJson | Output]};
prepare_status(Term, Ctx=#context{alert_set=true, alert_list=AList}) ->
Ctx#context{alert_list=[Term | AList]};
prepare_status({list, Data}, Ctx=#context{output=Output}) ->
Ctx#context{output=[prepare_list(Data) | Output]};
prepare_status({list, Title, Data}, Ctx=#context{output=Output}) ->
Expand Down

5 comments on commit a646e7f

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from andrewjstone
at a646e7f

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/clique/feature/json-writer = a646e7f into borshop-integration-47-feature/json-writer

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/clique/feature/json-writer = a646e7f merged ok, testing candidate = ac00915

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding develop to borshop-integration-47-feature/json-writer = ac00915

Please sign in to comment.