Skip to content

Commit 0825fb6

Browse files
committed
docs: Update documentation to explain automatic operation name extraction
1 parent e15f430 commit 0825fb6

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

ERROR_HANDLING_IMPROVEMENTS.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,29 @@ Authorization Model ID: 01GYYY...
107107

108108
### 4. Operation Context
109109

110-
Errors now track which operation failed, making debugging much easier.
110+
Errors now track which operation failed, making debugging much easier. Operation names are **automatically extracted** from telemetry attributes - no manual configuration needed!
111111

112112
```python
113113
try:
114-
client.check(...)
114+
await client.check(...)
115+
except ApiException as e:
116+
print(f"Operation '{e.operation_name}' failed")
117+
# Output: Operation 'check' failed
118+
119+
try:
120+
await client.write(...)
115121
except ApiException as e:
116122
print(f"Operation '{e.operation_name}' failed")
117-
# Output: Operation 'Check' failed
123+
# Output: Operation 'write' failed
118124
```
119125

126+
**How it works:**
127+
- The auto-generated `open_fga_api.py` passes telemetry attributes to every call
128+
- These attributes include `fga_client_request_method` (e.g., "check", "write")
129+
- `api_client.py` automatically extracts the operation name from telemetry
130+
- All exceptions get the operation name set automatically
131+
- No changes needed to generated code!
132+
120133
## Available Properties
121134

122135
All `ApiException` instances now have these properties:
@@ -128,7 +141,7 @@ All `ApiException` instances now have these properties:
128141
| `request_id` | `str \| None` | FGA request ID for tracing |
129142
| `store_id` | `str \| None` | Store ID context |
130143
| `authorization_model_id` | `str \| None` | Authorization model ID context |
131-
| `operation_name` | `str \| None` | Operation that failed (e.g., "Check", "Write") |
144+
| `operation_name` | `str \| None` | Operation that failed - auto-extracted from telemetry (e.g., "check", "write", "expand") |
132145

133146
## Available Helper Methods
134147

0 commit comments

Comments
 (0)