You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ERROR_HANDLING_IMPROVEMENTS.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,16 +107,29 @@ Authorization Model ID: 01GYYY...
107
107
108
108
### 4. Operation Context
109
109
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!
111
111
112
112
```python
113
113
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(...)
115
121
except ApiException as e:
116
122
print(f"Operation '{e.operation_name}' failed")
117
-
# Output: Operation 'Check' failed
123
+
# Output: Operation 'write' failed
118
124
```
119
125
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
+
120
133
## Available Properties
121
134
122
135
All `ApiException` instances now have these properties:
@@ -128,7 +141,7 @@ All `ApiException` instances now have these properties:
128
141
|`request_id`|`str \| None`| FGA request ID for tracing |
129
142
|`store_id`|`str \| None`| Store ID context |
130
143
|`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") |
0 commit comments