Skip to content

Fix/expunge historical version exception message #6880

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

patrick-werner
Copy link
Member

Summary

Improve exception handling in the asynchronous Expunge job so that missing historical versions throw a clear, contextual error instead of HAPI‑2223: null.

Changes

In JpaResourceExpungeService.expungeHistoricalVersion(), replace orElseThrow(IllegalArgumentException::new) with a lambda that includes the missing version’s ID and partition in the exception message.

Update PartitionRunner’s error‑handling to extract cause.getMessage() and propagate it, ensuring the logged and thrown InternalErrorException carries the real root‑cause text.

Add a simple unit test to verify that an absent history entry yields a non‑null, descriptive exception message.

Related issue
Closes #6879

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunner.java:130

  • [nitpick] Consider adding a separator (e.g., ': ') between Msg.code(1085) and cause.getMessage() to improve the clarity of the exception message.
throw new InternalErrorException(Msg.code(1085) + cause.getMessage(), cause);

@robogary
Copy link
Contributor

Formatting check succeeded!

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.

Improve expungeHistoricalVersion exception to include context (avoid HAPI-2223: null)
2 participants