anchor.diff:                                     non -> #answer{answer_status = atom_to_list(Main_Answer2), message_id = MsgId};
                                      _Type ->
                                          try
  -                                           DecoderName = list_to_existing_atom(Answer_decoder_name ++ "_pb"),
  -                                           EncodingFun = list_to_existing_atom("encode_" ++ AnswerType),
  -                                           try
  -                                               WAns = erlang:apply(DecoderName, EncodingFun, [records_translator:translate_to_record(Worker_Answer)]),
  -                                               case Main_Answer2 of
  -                                                   push ->
  -                                                       #answer{answer_status = atom_to_list(Main_Answer2), message_id = MsgId, message_type = AnswerType, worker_answer = WAns};
  -                                                   _ ->
  -                                                       #answer{answer_status = atom_to_list(Main_Answer2), message_id = MsgId, worker_answer = WAns}
  -                                               end
  -                                           catch
  -                                               Type:Error ->
  -                                                   ?error("Ranch handler error during encoding worker answer: ~p:~p, answer type: ~p, decoder ~p, worker answer ~p", [Type, Error, AnswerType, Answer_decoder_name, Worker_Answer]),
  -                                                   #answer{answer_status = "worker_answer_encoding_error", message_id = MsgId}
  -                                           end
  +                                         DecoderName = list_to_existing_atom(Answer_decoder_name ++ "_pb"),
  +                                         EncodingFun = list_to_existing_atom("encode_" ++ AnswerType),
  +                                         try
  +                                             WAns = erlang:apply(DecoderName, EncodingFun, [records_translator:translate_to_record(Worker_Answer)]),
  +                                             case Main_Answer2 of
  +                                                 push ->
  +                                                     #answer{answer_status = atom_to_list(Main_Answer2), message_id = MsgId, message_type = AnswerType, worker_answer = WAns};
  +                                                 _ ->
  +                                                     #answer{answer_status = atom_to_list(Main_Answer2), message_id = MsgId, worker_answer = WAns}
  +                                             end
  +                                         catch
  +                                             Type:Error ->
  +                                                 ?error("Ranch handler error during encoding worker answer: ~p:~p, answer type: ~p, decoder ~p, worker answer ~p", [Type, Error, AnswerType, Answer_decoder_name, Worker_Answer]),
  +                                                 #answer{answer_status = "worker_answer_encoding_error", message_id = MsgId}
  +                                         end
                                          catch
  -                                           _:_ ->
  -                                               ?error_stacktrace("Wrong decoder ~p or encoding function ~p", [Answer_decoder_name, AnswerType]),
  -                                               #answer{answer_status = "not_supported_answer_decoder", message_id = MsgId}
  +                                         _:_ ->
  +                                           ?error_stacktrace("Wrong decoder ~p or encoding function ~p", [Answer_decoder_name, AnswerType]),
  +                                           #answer{answer_status = "not_supported_answer_decoder", message_id = MsgId}
                                          end
                                  end;
                          false ->
  
positive.code:         token_hash = TokenHash, global_user_id = GlobalId} = DecodedBytes,
  
      {Decoder, DecodingFun, ModuleNameAtom} = try
          {list_to_existing_atom(Message_decoder_name ++ "_pb"), list_to_existing_atom("decode_" ++ Message_type), list_to_existing_atom(ModuleName)}
                                               catch
                                                   _:_ -> throw({message_not_supported, MsgId})
                                               end,
  
      Msg =
          try
  
negative.code:         Request =
              case PeerType of
                  provider -> decode_providermsg_pb(Data);
                  user     -> decode_clustermsg_pb(Data)
              end,
          ?debug("Received request: ~p", [Request]),
  
          handle(Req, Request, State) %% Decode ClusterMsg and handle it
      catch
          wrong_message_format                            -> {reply, {binary, encode_answer(wrong_message_format)}, Req, State};
          {wrong_internal_message_type, MsgId2}           -> {reply, {binary, encode_answer(wrong_internal_message_type, MsgId2)}, Req, State};
          {message_not_supported, MsgId2}                 -> {reply, {binary, encode_answer(message_not_supported, MsgId2)}, Req, State};
          {handshake_error, _HError, MsgId2}              -> {reply, {binary, encode_answer(handshake_error, MsgId2)}, Req, State};
          {no_credentials, MsgId2}                        -> {reply, {binary, encode_answer(no_credentials, MsgId2)}, Req, State};
          {no_user_found_error, _HError, MsgId2}          -> {reply, {binary, encode_answer(no_user_found_error, MsgId2)}, Req, State};
          {cert_confirmation_required, UserLogin, MsgId2} -> {reply, {binary, encode_answer(cert_confirmation_required, MsgId2, UserLogin)}, Req, State};
          {cert_denied_by_user, MsgId2}                   -> {reply, {binary, encode_answer(cert_denied_by_user, MsgId2)}, Req, State};
          {AtomError, MsgId2} when is_atom(AtomError)     -> {reply, {binary, encode_answer(AtomError, MsgId2)}, Req, State};
          _:Reason ->
              ?error_stacktrace("WSHandler failed due to: ~p", [Reason]),
              {reply, {binary, encode_answer(ws_handler_error)}, Req, State}
  