|
@@ -310,9 +310,20 @@ schema("/connectors/:id") ->
|
|
|
|
|
|
|
|
error_msg(Code, Msg) when is_binary(Msg) ->
|
|
error_msg(Code, Msg) when is_binary(Msg) ->
|
|
|
#{code => Code, message => Msg};
|
|
#{code => Code, message => Msg};
|
|
|
|
|
+error_msg(Code, {_, HoconErrors = [{Type, _} | _]}) when
|
|
|
|
|
+ Type == translation_error orelse Type == validation_error
|
|
|
|
|
+->
|
|
|
|
|
+ MessageFormat = [hocon_error(HoconError) || HoconError <- HoconErrors],
|
|
|
|
|
+ #{code => Code, message => bin(MessageFormat)};
|
|
|
error_msg(Code, Msg) ->
|
|
error_msg(Code, Msg) ->
|
|
|
#{code => Code, message => bin(io_lib:format("~p", [Msg]))}.
|
|
#{code => Code, message => bin(io_lib:format("~p", [Msg]))}.
|
|
|
|
|
|
|
|
|
|
+hocon_error({Type, Message0}) when
|
|
|
|
|
+ Type == translation_error orelse Type == validation_error
|
|
|
|
|
+->
|
|
|
|
|
+ Message = maps:without([stacktrace], Message0),
|
|
|
|
|
+ emqx_logger_jsonfmt:best_effort_json(Message#{<<"type">> => Type}, []).
|
|
|
|
|
+
|
|
|
format_resp(#{<<"type">> := ConnType, <<"name">> := ConnName} = RawConf) ->
|
|
format_resp(#{<<"type">> := ConnType, <<"name">> := ConnName} = RawConf) ->
|
|
|
NumOfBridges = length(
|
|
NumOfBridges = length(
|
|
|
emqx_bridge:list_bridges_by_connector(
|
|
emqx_bridge:list_bridges_by_connector(
|