Skip to content

Commit

Permalink
Return 1 when there are any GraphQL errors.
Browse files Browse the repository at this point in the history
This is easier to understand: code 0 means no errors.
  • Loading branch information
chrzaszcz committed Jul 8, 2022
1 parent 8d3b2c7 commit 5d784af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ejabberd_ctl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ process(Args) ->
handle_graphql_result({ok, Result}) ->
JSONResult = mongoose_graphql_response:term_to_pretty_json(Result),
?PRINT("~s\n", [JSONResult]),
?STATUS_SUCCESS;
case Result of
#{errors := _} -> ?STATUS_ERROR;
_ -> ?STATUS_SUCCESS
end;
handle_graphql_result({error, Reason}) ->
{_Code, Error} = mongoose_graphql_errors:format_error(Reason),
JSONResult = jiffy:encode(#{errors => [Error]}, [pretty]),
Expand Down

0 comments on commit 5d784af

Please sign in to comment.