Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: include request id in error result #4

Open
jb-delightai opened this issue Dec 11, 2023 · 1 comment
Open

feature request: include request id in error result #4

jb-delightai opened this issue Dec 11, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@jb-delightai
Copy link

Using the realtime client, our onResult handler can currently use the request_id parameter to identify the request corresponding to an api call, if that call is successful. However, since the onResult callback is typed as @escaping (Result<Output, Error>) -> Void, we can't identify requests for api call failures in the same way.

Some example code demonstrating the issue:

connection = try! falClient.realtime.connect(
    to: OptimizedLatentConsistency,
    connectionKey: "ReproDemo",
    throttleInterval: .milliseconds(0), // no need to throttle since i'm calling generate in response to a button tap
    onResult: { (result: Result<LcmResponse, Error>) in
        switch result {
        case .success(let data):
            // Can do things with data.requestId here
            print(data.requestId!)
        case .failure(let error):
            // ISSUE: Can't tie this back to the originating request, since there's no way to access request_id
            print(error)
        }
    }
)
@drochetti
Copy link
Collaborator

Thanks for bringing this up @jb-delightai. You're absolutely right, we need to add the request id to the errors. I'll work on it and let you know once it's fixed.

@drochetti drochetti added the enhancement New feature or request label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants