Skip to content

Commit

Permalink
update docs for HandlerExcepton and GRPC.Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
beligante committed Jul 10, 2024
1 parent e2cfe57 commit 1ebc0c5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
8 changes: 0 additions & 8 deletions lib/grpc/GRPC.Logger.ex

This file was deleted.

9 changes: 9 additions & 0 deletions lib/grpc/logger.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule GRPC.Logger do
@doc """
Normalizes the exception and stacktrace inputs by its kind to match the format specified for `crash_report` metadata
in [Logger](https://hexdocs.pm/logger/main/Logger.html#module-metadata)
"""
def crash_reason(:throw, reason, stacktrace), do: {{:nocatch, reason}, stacktrace}
def crash_reason(:error, reason, stack), do: {Exception.normalize(:error, reason, stack), stack}
def crash_reason(:exit, reason, stacktrace), do: {reason, stacktrace}
end
4 changes: 4 additions & 0 deletions lib/grpc/server/adapters/cowboy/handler_exception.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
defmodule GRPC.Server.Adapters.Cowboy.HandlerException do
@moduledoc """
Exception meant to represent failures captured in Cowboy.Handler
"""

defexception [:req, :kind, :reason, :stack]

def new(req, %{__exception__: _} = exception, stack \\ [], kind \\ :error) do
Expand Down

0 comments on commit 1ebc0c5

Please sign in to comment.