这是indexloc提供的服务,不要输入任何密码
Skip to content

Partial Errors Implementation #42

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

Merged
merged 29 commits into from
Mar 27, 2025
Merged

Partial Errors Implementation #42

merged 29 commits into from
Mar 27, 2025

Conversation

dconeybe
Copy link
Collaborator

@dconeybe dconeybe commented Feb 27, 2025

Adds support for GQL partial errors.

This change also refactors the base DataConnectError class to be a protocol and specific errors to be structs that implement this protocol.

do {
      _ = try await DataConnect.kitchenSinkConnector.deleteOrder.execute(id: id)
    } catch let dcError as DataConnectOperationError {
      guard let response = dcError.response,
       let data = response.data(asType: DeleteOrderMutation.Data.self) else {
        throw dcError
      }
      // handle partially decoded data
      
      // access json data
      let json = response.rawJsonData
    }

Refactored Error Types

do { 


} catch let initError as DataConnectInitError { 
   // handle err
} catch let codecError as DataConnectCodecError where codecError.code == .invalidUUID {
   // handle invalid uuid err
} 

@dconeybe dconeybe self-assigned this Feb 27, 2025
@aashishpatil-g aashishpatil-g changed the title DO NOT MERGE: partial errors wip [WIP]: Partial Errors Implementation Mar 21, 2025
@aashishpatil-g aashishpatil-g self-assigned this Mar 26, 2025
AnyDataConnectError just becomes a container of DataConnectError so it can contain both base and domain errors
@aashishpatil-g aashishpatil-g changed the title [WIP]: Partial Errors Implementation Partial Errors Implementation Mar 26, 2025
Copy link
Member

@ncooke3 ncooke3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly documentation improvements to which I left suggestions to make it easier to address. I also had two impl. questions in GrpcClient.swift.

@aashishpatil-g aashishpatil-g merged commit 5f80782 into main Mar 27, 2025
8 checks passed
@aashishpatil-g aashishpatil-g deleted the dconeybe/PartialErrors branch March 27, 2025 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants