Skip to content

feat: reformat; unify exception trees; disable gaos retries - #1189

Open
2ynn wants to merge 4 commits into
googleapis:mainfrom
speakeasy-sdks:feat/java/unified-exceptions
Open

feat: reformat; unify exception trees; disable gaos retries#1189
2ynn wants to merge 4 commits into
googleapis:mainfrom
speakeasy-sdks:feat/java/unified-exceptions

Conversation

@2ynn

@2ynn 2ynn commented Aug 19, 2026

Copy link
Copy Markdown

This PR unifies exception trees by:

  • adding a new Google.GenAI.ApiException : HttpRequestException base exception
  • reparenting native ClientError/ServerError are reparented under the new root
  • repaenting the gaos/ tree is onto the same root via injected carrier classes.
System.Exception
└── System.Net.Http.HttpRequestException
    └── Google.GenAI.ApiException                      ← NEW base — single catch
        ├── Google.GenAI.ClientError       (4xx, native)
        │   └── GaosClientError             (injected carrier)
        │       ├── CreateInteractionClientError
        │       ├── GetInteractionByIdClientError
        │       ├── CancelInteractionByIdClientError
        │       └── DeleteInteractionClientError
        ├── Google.GenAI.ServerError        (5xx, native)
        │   └── GaosServerError             (injected carrier)
        │       ├── CreateInteractionServerError
        │       ├── GetInteractionByIdServerError
        │       ├── CancelInteractionByIdServerError
        │       └── DeleteInteractionServerError
        └── Google.GenAI.Gaos.Models.Errors.GaosBaseException   (gaos root, reparented onto ApiException)
            ├── GaosApiException            (gaos default fallback)
            └── ResponseValidationException

As a result a single catch (Google.GenAI.ApiException) now covers every API error:

try {
    await client.Models.GenerateContentAsync(...);
    await client.Interactions.CreateAsync(...);
} catch (Google.GenAI.ApiException e) {
    int code = e.StatusCode;                            // native accessor, both surfaces
    // e is ClientError (4xx) or ServerError (5xx); gaos body still available
    // on the per-op error / carrier (e.g. ((GaosClientError)e).Body).
}

Additionally:

  • gaosBuilder.retryConfig(RetryConfig.noRetries()); was set to disable retries on the goas SDK so they don't interfere with the native ScheduleExecutorService
  • the generated SDK was reformatted (enableFormatting: true)

@2ynn
2ynn force-pushed the feat/java/unified-exceptions branch from 8375986 to c186a99 Compare August 19, 2026 01:31
@hemasekhar-p hemasekhar-p self-assigned this Aug 19, 2026
MarkDaoust and others added 4 commits August 19, 2026 10:40
…y as the rest of the SDK.

PiperOrigin-RevId: 964907713
Use HttpOptions.retryOptions to configure retries on the shared okhttp client.
@2ynn
2ynn force-pushed the feat/java/unified-exceptions branch from c186a99 to 1c86df8 Compare August 19, 2026 15:01
@2ynn 2ynn changed the title feat(java): reformat + unify exception trees feat(java): reformat; unify exception trees; disable gaos retries Aug 19, 2026
@2ynn 2ynn changed the title feat(java): reformat; unify exception trees; disable gaos retries feat: reformat; unify exception trees; disable gaos retries Aug 19, 2026
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