Skip to content

Commit f558c51

Browse files
authored
docs: update message for transaction ids
1 parent d1b2d19 commit f558c51

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -402,25 +402,25 @@ private void OnMessage(DetailedResponse<MessageResponse> response, IBMError erro
402402
```
403403

404404
## Transaction IDs
405-
Every SDK call will return a response which will contain a transaction ID, accessible via the `x-global-transaction-id` header. This transaction ID is useful for troubleshooting and accessing relevant logs from your service instance.
405+
Every SDK call returns a response with a transaction ID in the x-global-transaction-id header. This transaction ID is useful for troubleshooting and accessing relevant logs from your service instance.
406406

407407
```cs
408-
AssistantService service = new AssistantService("{version-date}");
409-
410-
public IEnumerator ExampleGetTransactionId()
408+
public void ExampleGetTransactionId()
411409
{
412-
WorkspaceCollection listWorkspacesResponse = null;
410+
AssistantService service = new AssistantService("{version-date}");
413411
service.ListWorkspaces(
414-
callback: (DetailedResponse<WorkspaceCollection> response, IBMError error) =>
412+
callback: (DetailedResponse<Workspace> response, IBMError error) =>
415413
{
416-
var globalTransactionId = response.Headers["x-global-transaction-id"];
417-
Log.Debug("AssistantServiceV1", "Global transaction id: {0}", globalTransactionId);
418-
listWorkspacesResponse = response.Result;
414+
if(error != null)
415+
{
416+
Log.Debug("AssistantServiceV1", "Transaction Id: {0}", error.ResponseHeaders["x-global-transaction-id"]);
417+
}
418+
else
419+
{
420+
Log.Debug("AssistantServiceV1", "Transaction Id: {0}", response.Headers["x-global-transaction-id"]);
421+
}
419422
}
420423
);
421-
422-
while (listWorkspacesResponse == null)
423-
yield return null;
424424
}
425425
```
426426

0 commit comments

Comments
 (0)