Skip to content

Commit

Permalink
Align the gpc_error types more with the code
Browse files Browse the repository at this point in the history
Add a type to specify what error values that the server side
can handle from rpc method callback functions, since this
is slightly different from the errors that can be returned
on the client side.
  • Loading branch information
tomas-abrahamsson committed May 13, 2022
1 parent 1fbde82 commit 8f3448c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/grpcbox_stream.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
grpc_status_message/0,
grpc_error/0,
grpc_error_response/0,
grpc_callback_error/0,
grpc_error_data/0,
grpc_extended_error_response/0]).

Expand Down Expand Up @@ -61,15 +62,19 @@

-type t() :: #state{}.

-type grpc_status_message() :: unicode:chardata().
-type grpc_status_message() :: unicode:unicode_binary().
-type grpc_status() :: 0..16.
-type http_status() :: integer().
-type grpc_error() :: {grpc_status(), grpc_status_message()}.
-type grpc_error() :: {unicode:unicode_binary(), % containing a grpc_status() value as text
grpc_status_message()}.
-type grpc_error_response() :: {error, grpc_error(), #{headers => map(),
trailers => #{}}} |
{http_error, {http_status(), unicode:chardata()}, #{headers => map(),
trailers => #{}}} |
{error, term()}.
-type grpc_callback_error() :: {error, grpc_error(), #{headers => map(),
trailers => #{}}}.

-type grpc_error_data() :: #{
status := grpc_status(),
message := grpc_status_message(),
Expand Down

0 comments on commit 8f3448c

Please sign in to comment.