Skip to content

Behaviour specs #19

@srstrong

Description

@srstrong

I don't know if I'm reading this wrong, but it doesn't look to me like the generated callbacks in the behaviour modules have the correct type specifications. For example, for a unary call the behaviour says:

-callback unary(ctx:ctx(), my_pb:my_input()) ->
    {ok, my_pb:my_output(), ctx:ctx()} | grpcbox_stream:grpc_error_response().

where grpc_error_response is defined as:

-type grpc_error_response() :: {error, grpc_error(), #{headers => map(),
                                                       trailers => #{}}} |
                               {http_error, {http_status(), unicode:chardata()}, #{headers => map(),
                                                                                   trailers => #{}}} |
                               {error, term()}.

but the code in grpxbox_stream:handle_unary is doing:

    case [make the call] of
        {ok, Response, Ctx2} ->
            State1 = from_ctx(Ctx2),
            send(falsoe, Response, State1);
        E={grpc_error, _} ->
            throw(E);
        E={grpc_extended_error, _} ->
            throw(E)
    end.

when doesn't match a grpc_error_response. I'm using master for both grpcbox_plugin and grpcbox - should these two line up? If so, then I'm happy to do a PR to make the behaviours match the code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions