Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-825

Erlang API improvement: allow to use atoms and tuples to point at the thrift client

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Erlang - Compiler
    • Labels:
      None
    • Environment:

      Any environment

    • Patch Info:
      Patch Available

      Description

      Here's the code from thrift_client.erl:

      call(Client, Function, Args)
      when is_pid(Client), is_atom(Function), is_list(Args) ->
      case gen_server:call(Client,

      {call, Function, Args}

      ) of
      R =

      {ok, _}

      -> R;
      R =

      {error, _}

      -> R;

      {exception, Exception}

      -> throw(Exception)
      end.

      But one may want to use the Client variable as an atom (using erlang:register()) or as a tuple

      {Node, Pid}

      .

      So, it's better to remove the is_pid() check. If the Client variable is invalid - OTP will just raise the "noproc" exception.

        Attachments

        1. thrift_client.erl.diff
          2 kB
          Dmitry Demeshchuk

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              demmonoid Dmitry Demeshchuk
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: