Skip to content

feature request: include request id in error result #4

@jb-chief

Description

@jb-chief

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)
        }
    }
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions