Skip to content

Commit

Permalink
open-telemetry#894: moved repeating null check to internal methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rypdal committed Aug 9, 2023
1 parent 556bd8a commit 888dbec
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public static TResult Trace<TInput, TResult>(
ActivityContext parentContext = default)
{
Guard.ThrowIfNull(lambdaHandler);
Guard.ThrowIfNull(context);

return TraceInternal(tracerProvider, lambdaHandler, input, context, parentContext);
}
Expand All @@ -99,7 +98,6 @@ public static void Trace<TInput>(
ActivityContext parentContext = default)
{
Guard.ThrowIfNull(lambdaHandler);
Guard.ThrowIfNull(context);

object? Handler(TInput input, ILambdaContext context)
{
Expand Down Expand Up @@ -133,7 +131,6 @@ public static Task TraceAsync<TInput>(
ActivityContext parentContext = default)
{
Guard.ThrowIfNull(lambdaHandler);
Guard.ThrowIfNull(context);

async Task<object?> Handler(TInput input, ILambdaContext context)
{
Expand Down Expand Up @@ -223,6 +220,8 @@ private static TResult TraceInternal<TInput, TResult>(
ILambdaContext context,
ActivityContext parentContext = default)
{
Guard.ThrowIfNull(context);

var activity = OnFunctionStart(input, context, parentContext);
try
{
Expand All @@ -249,6 +248,8 @@ private static async Task<TResult> TraceInternalAsync<TInput, TResult>(
ILambdaContext context,
ActivityContext parentContext = default)
{
Guard.ThrowIfNull(context);

var activity = OnFunctionStart(input, context, parentContext);
try
{
Expand Down

0 comments on commit 888dbec

Please sign in to comment.