Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements the initial version of the exception handling library by introducing the Exc class that accepts a reason (a record) and an optional cause, and includes methods for message formatting, runtime conversion, and serialization.
- Introduces the Exc class with constructors, custom toString(), and serialization support.
- Implements comprehensive JUnit tests covering construction, getters, exception message formatting, and serialization behaviors.
- Removes legacy Sample and SampleTest files that are no longer necessary.
Reviewed Changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/github/sttk/errs/ExcTest.java | Tests for the new Exc class (constructors, getters, serialization, etc.) |
| src/test/java/SampleTest.java | Removed legacy test file |
| src/main/java/module-info.java | New module declaration supporting the library |
| src/main/java/com/github/sttk/errs/package-info.java | Package documentation for the exception handling API |
| src/main/java/com/github/sttk/errs/Exc.java | New Exc class implementation with runtime conversion and serialization |
| src/main/java/Sample.java | Removed legacy implementation |
Files not reviewed (2)
- src/main/resources/META-INF/native-image/com.github.sttk/errs/reachability-metadata.json: Language not supported
- src/test/resources/META-INF/native-image/reachability-metadata.json: Language not supported
…pport reachability-metadata.json
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the initial implementation of the Exc exception class along with comprehensive tests covering construction, message formatting, and serialization/deserialization behavior.
- Introduces the Exc class (and its RuntimeExc wrapper) for exceptions with a record-based reason.
- Adds extensive JUnit tests in ExcTest.java to validate exception properties and serialization.
- Removes the sample code and test artifacts not associated with the new functionality.
Reviewed Changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/github/sttk/errs/Exc.java | Implements the core Exc exception with custom message formatting and serialization logic. |
| src/test/java/com/github/sttk/errs/ExcTest.java | Provides tests for constructors, getters, toString(), and serialization of Exc. |
| src/main/java/module-info.java | Defines module metadata for the errs package. |
| src/main/java/com/github/sttk/errs/package-info.java | Provides package-level documentation for the errs package. |
| src/test/java/SampleTest.java & src/main/java/Sample.java | Removes unused sample test and sample implementation files. |
Files not reviewed (2)
- src/main/resources/META-INF/native-image/com.github.sttk/errs/serialization-config.json: Language not supported
- src/test/resources/META-INF/native-image/serialization-config.json: Language not supported
Comments suppressed due to low confidence (1)
src/test/java/com/github/sttk/errs/ExcTest.java:156
- [nitpick] Hardcoding the expected line number in the test makes it brittle; any refactoring or change in the code location could cause false negatives. Consider a more flexible approach to validate the line number, such as checking for a range or using metadata.
assertThat(exc.getLine()).isEqualTo(155);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR provides the implementation of the
Errclass as the first implementation of this library.