Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cwa App Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Foertsch
Cwa App Android
Commits
d7a1ceaa
Unverified
Commit
d7a1ceaa
authored
4 years ago
by
Leo
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
#918 Fix Hard coded by Http Status code judgment. (#919)
Co-authored-by:
Matthias Urhahn
<
darken@darken.eu
>
parent
7bed1d48
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/HttpErrorParser.kt
+18
-17
18 additions, 17 deletions
...rc/main/java/de/rki/coronawarnapp/http/HttpErrorParser.kt
with
18 additions
and
17 deletions
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/HttpErrorParser.kt
+
18
−
17
View file @
d7a1ceaa
...
@@ -27,30 +27,31 @@ import de.rki.coronawarnapp.exception.http.UnsupportedMediaTypeException
...
@@ -27,30 +27,31 @@ import de.rki.coronawarnapp.exception.http.UnsupportedMediaTypeException
import
okhttp3.Interceptor
import
okhttp3.Interceptor
import
okhttp3.Response
import
okhttp3.Response
import
java.net.UnknownHostException
import
java.net.UnknownHostException
import
javax.net.ssl.HttpsURLConnection
class
HttpErrorParser
:
Interceptor
{
class
HttpErrorParser
:
Interceptor
{
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
try
{
try
{
val
response
=
chain
.
proceed
(
chain
.
request
())
val
response
=
chain
.
proceed
(
chain
.
request
())
return
when
(
val
code
=
response
.
code
)
{
return
when
(
val
code
=
response
.
code
)
{
200
->
response
HttpsURLConnection
.
HTTP_OK
->
response
201
->
response
HttpsURLConnection
.
HTTP_CREATED
->
response
202
->
response
HttpsURLConnection
.
HTTP_ACCEPTED
->
response
204
->
response
HttpsURLConnection
.
HTTP_NO_CONTENT
->
response
400
->
throw
BadRequestException
()
HttpsURLConnection
.
HTTP_BAD_REQUEST
->
throw
BadRequestException
()
401
->
throw
UnauthorizedException
()
HttpsURLConnection
.
HTTP_UNAUTHORIZED
->
throw
UnauthorizedException
()
403
->
throw
ForbiddenException
()
HttpsURLConnection
.
HTTP_FORBIDDEN
->
throw
ForbiddenException
()
404
->
throw
NotFoundException
()
HttpsURLConnection
.
HTTP_NOT_FOUND
->
throw
NotFoundException
()
409
->
throw
ConflictException
()
HttpsURLConnection
.
HTTP_CONFLICT
->
throw
ConflictException
()
410
->
throw
GoneException
()
HttpsURLConnection
.
HTTP_GONE
->
throw
GoneException
()
415
->
throw
UnsupportedMediaTypeException
()
HttpsURLConnection
.
HTTP_UNSUPPORTED_TYPE
->
throw
UnsupportedMediaTypeException
()
429
->
throw
TooManyRequestsException
()
429
->
throw
TooManyRequestsException
()
500
->
throw
InternalServerErrorException
()
HttpsURLConnection
.
HTTP_INTERNAL_ERROR
->
throw
InternalServerErrorException
()
501
->
throw
NotImplementedException
()
HttpsURLConnection
.
HTTP_NOT_IMPLEMENTED
->
throw
NotImplementedException
()
502
->
throw
BadGatewayException
()
HttpsURLConnection
.
HTTP_BAD_GATEWAY
->
throw
BadGatewayException
()
503
->
throw
ServiceUnavailableException
()
HttpsURLConnection
.
HTTP_UNAVAILABLE
->
throw
ServiceUnavailableException
()
504
->
throw
GatewayTimeoutException
()
HttpsURLConnection
.
HTTP_GATEWAY_TIMEOUT
->
throw
GatewayTimeoutException
()
505
->
throw
HTTPVersionNotSupported
()
HttpsURLConnection
.
HTTP_VERSION
->
throw
HTTPVersionNotSupported
()
511
->
throw
NetworkAuthenticationRequiredException
()
511
->
throw
NetworkAuthenticationRequiredException
()
598
->
throw
NetworkReadTimeoutException
()
598
->
throw
NetworkReadTimeoutException
()
599
->
throw
NetworkConnectTimeoutException
()
599
->
throw
NetworkConnectTimeoutException
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment