Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix Ruby SDK
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Olofsson
Matrix Ruby SDK
Commits
fab9c75e
Verified
Commit
fab9c75e
authored
4 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
api: Improve handling of broken 200 responses
parent
c5552d6c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
lib/matrix_sdk/api.rb
+12
-2
12 additions, 2 deletions
lib/matrix_sdk/api.rb
with
13 additions
and
2 deletions
CHANGELOG.md
+
1
−
0
View file @
fab9c75e
...
...
@@ -2,6 +2,7 @@
-
Adds separate state event handler as Client#on_state_event
-
Fixes state events being sent twice if included in both timeline and state of a sync
-
Improves error reporting of broken 200 responses
-
Improves event handlers for rooms, to not depend on a specific room object instance anymore
## 2.1.2 - 2020-09-10
...
...
This diff is collapsed.
Click to expand it.
lib/matrix_sdk/api.rb
+
12
−
2
View file @
fab9c75e
...
...
@@ -304,7 +304,11 @@ module MatrixSdk
end
print_http
(
response
,
duration:
duration
,
id:
req_id
)
data
=
JSON
.
parse
(
response
.
body
,
symbolize_names:
true
)
rescue
nil
begin
data
=
JSON
.
parse
(
response
.
body
,
symbolize_names:
true
)
rescue
data
=
nil
end
if
response
.
is_a?
Net
::
HTTPTooManyRequests
raise
MatrixRequestError
.
new_by_code
(
data
,
response
.
code
)
unless
autoretry
...
...
@@ -315,7 +319,13 @@ module MatrixSdk
next
end
return
MatrixSdk
::
Response
.
new
self
,
data
if
response
.
is_a?
Net
::
HTTPSuccess
if
response
.
is_a?
Net
::
HTTPSuccess
unless
data
logger
.
error
"Received non-parsable data in 200 response;
#{
response
.
body
.
inspect
}
"
raise
MatrixConnectionError
,
response
end
return
MatrixSdk
::
Response
.
new
self
,
data
end
raise
MatrixRequestError
.
new_by_code
(
data
,
response
.
code
)
if
data
raise
MatrixConnectionError
.
class_by_code
(
response
.
code
),
response
...
...
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