Skip to content

Support endpoint errors#2401

Merged
bulldozer-bot[bot] merged 25 commits intodevelopfrom
pm/endpoint-errors
Nov 18, 2024
Merged

Support endpoint errors#2401
bulldozer-bot[bot] merged 25 commits intodevelopfrom
pm/endpoint-errors

Conversation

@mpritham
Copy link
Contributor

@mpritham mpritham commented Nov 6, 2024

Before this PR

Endpoint errors were added to the Conjure specification in this PR. conjure-java does not use user-defined endpoint errors.

After this PR

Generated ServerErrors classes

Developers will be able to create checked exceptions for each error that is defined as an error an endpoint can throw. Specifically, for each endpoint-defined error, conjure-java will generate a class for the error's namespace with name {namespace}ServerErrors. This class will hold the definition of an exception, which is a sub-class of CheckedServiceException (introduced here), as well as methods to construct the exception.

Changes to Errors classes

When an error is used as an endpoint error, factory methods to create ServiceExceptions are no longer provided in the Errors utility classes. 🌶️ This means that once an error becomes associated with an endpoint, it can no longer be used to throw un-checked runtime exceptions. This is intentional and acts as a forcing function for adoption: associating errors with one endpoint will require users to add endpoint errors for all of the endpoints throwing the error.

Updates to Undertow Service Interfaces and Handlers

For each endpoint that defines endpoint-errors, the corresponding endpoint in the Undertow service interface, and the endpoint handler method, will include a throws clause including the list of checked exceptions corresponding to the endpoint errors, that were generated in the ServerErrors class (see above).

Jersey

Endpoint errors will not be supported on Jersey servers. An exception will be thrown if a user attempts to generate code for Jersey services with endpoint errors defined.

==COMMIT_MSG==
Support endpoint errors
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented Nov 6, 2024

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Support endpoint errors

Check the box to generate changelog(s)

  • Generate changelog entry

@mpritham mpritham force-pushed the pm/endpoint-errors branch 2 times, most recently from bf0d2aa to 86cf0f3 Compare November 6, 2024 22:02
@mpritham
Copy link
Contributor Author

mpritham commented Nov 7, 2024

This is good for a re-review. Shouldn't be merged: it has the CheckedServiceException class which we'd like to be in the conjure-java-runtime-api repo, it uses an RC version of conjure.

Going to branch off of this to work on the error serialization piece.

@mpritham mpritham changed the title [wip] Generate checked exceptions for endpoint errors when they are defined Support endpoint errors Nov 13, 2024
@mpritham mpritham marked this pull request as ready for review November 13, 2024 17:54
versions.props Outdated
Comment on lines 9 to 12
com.palantir.conjure.java.api:* = 2.56.0-rc1
com.palantir.conjure.java.runtime:* = 8.7.0
com.palantir.conjure.verification:* = 0.19.0
com.palantir.conjure:* = 4.36.0
com.palantir.conjure:* = 4.50.0-rc2
Copy link
Contributor

Choose a reason for hiding this comment

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

we should be able to update both of these now

@carterkozak
Copy link
Contributor

Looks good, just needs a changelog!

@bulldozer-bot bulldozer-bot bot merged commit e4f5cb6 into develop Nov 18, 2024
@bulldozer-bot bulldozer-bot bot deleted the pm/endpoint-errors branch November 18, 2024 20:12
@autorelease3
Copy link

autorelease3 bot commented Nov 18, 2024

Released 8.32.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants