Add fallback when binary encoding is failed
AndrewDryga opened this issue · comments
GenServer #PID<0.262.0> terminating
** (stop) {:EXIT, {%Jason.EncodeError{message: "invalid byte 0xF0 in <<125, 95, 95, 116, 101, 115, 116, 124, 79, 58, 50, 49, 58, 34, 74, 68, 97, 116, 97, 98, 97, 115, 101, 68, 114, 105, 118, 101, 114, 77, 121, 115, 113, 108, 105, 34, 58, 51, 58, 123, 115, 58, 50, 58, 34, 102, 99, 34, 59, 79, ...>>"}, [{Jason, :encode_to_iodata!, 2, [file: 'lib/jason.ex', line: 199]}, {LoggerJSON, :format_event, 5, [file: 'lib/logger_json.ex', line: 299]}, {LoggerJSON, :log_event, 5, [file: 'lib/logger_json.ex', line: 234]}, {LoggerJSON, :handle_event, 2, [file: 'lib/logger_json.ex', line: 139]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 573]}, {:gen_event, :server_notify, 4, [file: 'gen_event.erl', line: 555]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 296]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]}}
Last message: {:gen_event_EXIT, LoggerJSON, {:EXIT, {%Jason.EncodeError{message: "invalid byte 0xF0 in <<125, 95, 95, 116, 101, 115, 116, 124, 79, 58, 50, 49, 58, 34, 74, 68, 97, 116, 97, 98, 97, 115, 101, 68, 114, 105, 118, 101, 114, 77, 121, 115, 113, 108, 105, 34, 58, 51, 58, 123, 115, 58, 50, 58, 34, 102, 99, 34, 59, 79, ...>>"}, [{Jason, :encode_to_iodata!, 2, [file: 'lib/jason.ex', line: 199]}, {LoggerJSON, :format_event, 5, [file: 'lib/logger_json.ex', line: 299]}, {LoggerJSON, :log_event, 5, [file: 'lib/logger_json.ex', line: 234]}, {LoggerJSON, :handle_event, 2, [file: 'lib/logger_json.ex', line: 139]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 573]}, {:gen_event, :server_notify, 4, [file: 'gen_event.erl', line: 555]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 296]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]}}}