Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
File Transfer Service
fts-rest
Commits
b6980b41
Commit
b6980b41
authored
Nov 07, 2018
by
Andrea Manzi
Browse files
FTS-1325
: report reason for Unauthorized exception
parent
577a01f2
Pipeline
#576336
passed with stage
in 1 minute and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/fts3/rest/client/exceptions.py
View file @
b6980b41
...
...
@@ -28,8 +28,14 @@ class BadEndpoint(FTS3ClientException):
class
Unauthorized
(
FTS3ClientException
):
def
__init__
(
self
,
reason
):
self
.
reason
=
reason
def
__str__
(
self
):
return
"Unauthorized"
if
self
.
reason
:
return
"Unauthorized: %s"
%
self
.
reason
else
:
return
"Unauthorized"
class
ClientError
(
FTS3ClientException
):
...
...
src/fts3/rest/client/request.py
View file @
b6980b41
...
...
@@ -65,7 +65,10 @@ class Request(object):
else
:
raise
ClientError
(
'Bad request'
)
elif
401
<=
code
<=
403
:
raise
Unauthorized
()
if
message
:
raise
Unauthorized
(
message
)
else
:
raise
Unauthorized
()
elif
code
==
404
:
raise
NotFound
(
url
,
message
)
elif
code
==
419
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment