Skip to content
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

Add redirect location to exception message #28

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/kotlin/de/gmuth/ipp/client/IppClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ open class IppClient(val config: IppConfig = IppConfig()) {

responseCode == 401 -> with(request) { "Not authorized for operation $operation on $printerOrJobUri (userName required)" }
responseCode == 426 -> "HTTP status $responseCode, $responseMessage, Try ipps://${request.printerOrJobUri.host}"
responseCode in 300..399 -> {
val locationHeader = headerFields["Location"] ?: headerFields["location"]
"HTTP redirect: $responseCode, $responseMessage redirect-location: $locationHeader"
}
responseCode != 200 -> "HTTP request failed: $responseCode, $responseMessage"
contentType != null && !contentType.startsWith(APPLICATION_IPP) -> "Invalid Content-Type: $contentType"
exception != null -> exception.message
Expand Down
Loading