Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
1f5e1887
Commit
1f5e1887
authored
Jun 30, 2018
by
nobodyiam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
when server returns status code other than 200 and 304, we should throw…
when server returns status code other than 200 and 304, we should throw ApolloConfigStatusCodeException
parent
9d5646fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
ApolloConfigStatusCodeException.java
...rk/apollo/exceptions/ApolloConfigStatusCodeException.java
+5
-0
HttpUtil.java
...n/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
+9
-1
No files found.
apollo-client/src/main/java/com/ctrip/framework/apollo/exceptions/ApolloConfigStatusCodeException.java
View file @
1f5e1887
...
...
@@ -11,6 +11,11 @@ public class ApolloConfigStatusCodeException extends RuntimeException{
this
.
m_statusCode
=
statusCode
;
}
public
ApolloConfigStatusCodeException
(
int
statusCode
,
Throwable
cause
)
{
super
(
cause
);
this
.
m_statusCode
=
statusCode
;
}
public
int
getStatusCode
()
{
return
m_statusCode
;
}
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
View file @
1f5e1887
...
...
@@ -116,7 +116,13 @@ public class HttpUtil {
}
}
throw
ex
;
// 200 and 304 should not trigger IOException, thus we must throw the original exception out
if
(
statusCode
==
200
||
statusCode
==
304
)
{
throw
ex
;
}
else
{
// for status codes like 404, IOException is expected when calling conn.getInputStream()
throw
new
ApolloConfigStatusCodeException
(
statusCode
,
ex
);
}
}
if
(
statusCode
==
200
)
{
...
...
@@ -126,6 +132,8 @@ public class HttpUtil {
if
(
statusCode
==
304
)
{
return
new
HttpResponse
<>(
statusCode
,
null
);
}
}
catch
(
ApolloConfigStatusCodeException
ex
)
{
throw
ex
;
}
catch
(
Throwable
ex
)
{
throw
new
ApolloConfigException
(
"Could not complete get operation"
,
ex
);
}
finally
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment