new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Temporal · all subjects

activities: error handling

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

How to mark an Activity error as benign in .NET

Set the category parameter to ApplicationErrorCategory.Benign when throwing an ApplicationFailureException to mark an Activity error as benign.

Benign exception example in .NET

```csharp using Temporalio.Activities; using Temporalio.Api.Enums.V1; using Temporalio.Exceptions; public class MyActivities { [Activity] public async Task<string> MyActivityAsync() { try { return await CallExternalServiceAsync(); } catch (Exception e) { // Mark this error as benign since it's expected throw new ApplicationFailureException( "Service is down", inner: e, category: ApplicationErrorCategory.Benign); } } } ``` This example shows how to throw an ApplicationFailureException with ApplicationErrorCategory.Benign for an expected service unavailability error.

Benign exceptions reduce noise in logs and metrics

When activities return errors that are expected or not severe, they can create noise in logs, metrics, and OpenTelemetry traces. Marking these errors as benign excludes them from observability data while still handling them in workflow logic.

Mark errors as benign using NewApplicationErrorWithOptions

To mark an error as benign in Go, use temporal.NewApplicationErrorWithOptions and set the Category field to temporal.ApplicationErrorCategoryBenign in the ApplicationErrorOptions.

Benign exceptions effects on activity observability

Benign errors have activity failure logs downgraded to DEBUG level, do not emit activity failure metrics, and do not set the OpenTelemetry failure status to ERROR.

Code example: marking an activity error as benign

import ( "go.temporal.io/sdk/activity" "go.temporal.io/sdk/temporal" ) func MyActivity(ctx context.Context) (string, error) { result, err := callExternalService() if err != nil { // Mark this error as benign since it's expected return "", temporal.NewApplicationErrorWithOptions( err.Error(), "", temporal.ApplicationErrorOptions{ Category: temporal.ApplicationErrorCategoryBenign, }, ) } return result, nil }

Give your agent this brain