interceptors

Community

Centralize gRPC errors, culture, and claims

AuthorFaysilAlshareef
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Centralize cross-cutting gRPC concerns so you avoid duplicate error handling, manual culture management, and ad-hoc claims parsing across many service handlers. Implementing interceptors keeps handlers focused on business logic while ensuring consistent error mapping, localization, and claims availability.

Core Features & Use Cases

  • Exception mapping: Map domain exceptions to RpcException with ProblemDetails and appropriate gRPC status codes to provide consistent client errors.
  • Culture propagation: Read a language header and set the thread culture so handlers and serializers operate under the correct localization settings.
  • Claims extraction and client propagation: Decode access-claims-bin into a request user state and add language headers on outgoing client calls to preserve context between services.
  • Use Case: Add these interceptors in any .NET gRPC service to standardize error responses, localized behavior, and cross-service identity claims without polluting individual handlers.

Quick Start

Register ThreadCultureInterceptor, AccessClaimsInterceptor, then ApplicationExceptionInterceptor in your AddGrpc configuration to enable culture propagation, claims decoding, and exception mapping.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: interceptors
Download link: https://github.com/FaysilAlshareef/dotnet-ai-kit/archive/main.zip#interceptors

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.