-
-
Notifications
You must be signed in to change notification settings - Fork 19
Make DavException and HttpException immutable; provide status code for HttpException #94
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
base: main
Are you sure you want to change the base?
Conversation
…Exception always has a status code
35f3fe7
to
5d708cc
Compare
5d708cc
to
b6648bb
Compare
There was a problem hiding this 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 refactors the DavException
and HttpException
classes to make them immutable and ensures HttpException
always has a status code. The refactoring extracts HTTP response information processing into a separate HttpResponseInfo
class to improve separation of concerns and testability.
Key changes:
- Made exception data immutable by converting mutable properties to constructor parameters
- Extracted HTTP response processing logic into
HttpResponseInfo
class with comprehensive test coverage - Ensured
HttpException
always has a non-null status code through constructor design
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/main/kotlin/at/bitfire/dav4jvm/exception/DavException.kt | Refactored to use immutable properties and delegate HTTP processing to HttpResponseInfo |
src/main/kotlin/at/bitfire/dav4jvm/exception/HttpException.kt | Made immutable with guaranteed status code and added convenience properties for status classification |
src/main/kotlin/at/bitfire/dav4jvm/exception/HttpResponseInfo.kt | New class extracting HTTP response processing logic with proper text/XML detection |
src/test/kotlin/at/bitfire/dav4jvm/exception/DavExceptionTest.kt | Simplified tests to focus on constructor behavior and serialization |
src/test/kotlin/at/bitfire/dav4jvm/exception/HttpExceptionTest.kt | New comprehensive tests for HttpException functionality |
src/test/kotlin/at/bitfire/dav4jvm/exception/HttpResponseInfoTest.kt | New comprehensive tests for HttpResponseInfo extraction logic |
src/test/kotlin/at/bitfire/dav4jvm/exception/ServiceUnavailableExceptionTest.kt | Minor formatting improvements to request builder |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Addresses the
DavException
andHttpException
issues mentioned in #93:HttpException
is guaranteed to have a status code. The status codes 3xx, 4xx and 5xx can now explicitly be detected byisRedirect
etc., as this is often used by DAVx⁵.Extracting the HTTP information (status code request/response excerpt) has been moved to a separate class which is also tested separately.