Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
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
caosdb
Software
caosdb-pylib
Commits
8883815a
Commit
8883815a
authored
3 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Fix
https://gitlab.com/linkahead/linkahead-pylib/-/issues/87
parent
4d6d1c86
No related branches found
No related tags found
2 merge requests
!175
BUG: Request responses without the "Set-Cookie" header no longer overwrite the...
,
!169
F fix timeout error messages
Pipeline
#58908
passed
3 months ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/linkahead/exceptions.py
+20
-6
20 additions, 6 deletions
src/linkahead/exceptions.py
with
20 additions
and
6 deletions
src/linkahead/exceptions.py
+
20
−
6
View file @
8883815a
...
...
@@ -94,12 +94,26 @@ class HTTPServerError(LinkAheadException):
"""
HTTPServerError represents 5xx HTTP server errors.
"""
def
__init__
(
self
,
body
):
xml
=
etree
.
fromstring
(
body
)
error
=
xml
.
xpath
(
'
/Response/Error
'
)[
0
]
msg
=
error
.
get
(
"
description
"
)
if
error
.
text
is
not
None
:
msg
=
msg
+
"
\n\n
"
+
error
.
text
try
:
# This only works if the server sends a valid XML
# response. Then it can be parsed for more information.
xml
=
etree
.
fromstring
(
body
)
if
xml
.
xpath
(
'
/Response/Error
'
):
error
=
xml
.
xpath
(
'
/Response/Error
'
)[
0
]
msg
=
error
.
get
(
"
description
"
)
if
error
.
get
(
"
description
"
)
is
not
None
else
""
if
error
.
text
is
not
None
:
if
msg
:
msg
=
msg
+
"
\n\n
"
+
error
.
text
else
:
msg
=
error
.
text
else
:
# Valid XML, but no error information
msg
=
body
except
etree
.
XMLSyntaxError
:
# Handling of incomplete responses, e.g., due to timeouts,
# c.f. https://gitlab.com/linkahead/linkahead-pylib/-/issues/87.
msg
=
body
LinkAheadException
.
__init__
(
self
,
msg
)
...
...
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