Skip to content

Commit

Permalink
Docs: Improves the module docs for error statuses.
Browse files Browse the repository at this point in the history
Adds a markdown table to detail each code status and its related message.

Closes elixir-grpc#170
  • Loading branch information
hackvan committed May 30, 2023
1 parent fc0b9bb commit 50f09ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/grpc/error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ defmodule GRPC.RPCError do
# client side
{:error, error} = Your.Stub.unary_call(channel, request)
See GRPC.Status for more details on possible statuses.
"""

defexception [:status, :message]
Expand Down
26 changes: 23 additions & 3 deletions lib/grpc/status.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
defmodule GRPC.Status do
@moduledoc """
Collection of gRPC status.
Please refer to https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/status.h
Collection of gRPC status:
Code | Status | Status Message
-----:|------------------------|-----------------------------------------------------------------------------------------------------
0 | :ok |
1 | :cancelled | The operation was cancelled (typically by the caller)
2 | :unknown | Unknown error
3 | :invalid_argument | Client specified an invalid argument
4 | :deadline_exceeded | Deadline expired before operation could complete
5 | :not_found | Some requested entity (e.g., file or directory) was not found
6 | :already_exists | Some entity that we attempted to create (e.g., file or directory) already exists
7 | :permission_denied | The caller does not have permission to execute the specified operation
8 | :resource_exhausted | Some resource has been exhausted
9 | :failed_precondition | Operation was rejected because the system is not in a state required for the operation's execution
10 | :aborted | The operation was aborted
11 | :out_of_range | Operation was attempted past the valid range
12 | :unimplemented | Operation is not implemented or not supported/enabled in this service
13 | :internal | Internal errors
14 | :unavailable | The service is currently unavailable
15 | :data_loss | Unrecoverable data loss or corruption
16 | :unauthenticated | The request does not have valid authentication credentials for the operation
For more detail information, please refer to https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/status.h
"""

@type t :: non_neg_integer
Expand Down

0 comments on commit 50f09ab

Please sign in to comment.