Skip to content

Conversation

@sttk
Copy link
Owner

@sttk sttk commented Apr 26, 2025

This PR provides the implementation of the Err class as the first implementation of this library.

@sttk sttk requested a review from Copilot April 26, 2025 13:50
Copy link

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.

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

@sttk sttk requested a review from Copilot April 26, 2025 14:52
Copy link

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.

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);

@sttk sttk merged commit 2021580 into main Apr 26, 2025
12 checks passed
@sttk sttk deleted the first-impl branch April 26, 2025 14:57
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.

2 participants