mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 12:01:14 +00:00
improve error handling
This commit is contained in:
parent
5bbd6faa8b
commit
c817ea0ff9
2 changed files with 4 additions and 3 deletions
|
@ -157,7 +157,7 @@ def remote_follow(request):
|
||||||
if remote_user[0] == "@":
|
if remote_user[0] == "@":
|
||||||
remote_user = remote_user[1:]
|
remote_user = remote_user[1:]
|
||||||
remote_domain = remote_user.split("@")[1]
|
remote_domain = remote_user.split("@")[1]
|
||||||
except:
|
except IndexError:
|
||||||
remote_domain = None
|
remote_domain = None
|
||||||
|
|
||||||
wf_response = subscribe_remote_webfinger(remote_user)
|
wf_response = subscribe_remote_webfinger(remote_user)
|
||||||
|
@ -172,7 +172,7 @@ def remote_follow(request):
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "ostatus/subscribe.html", data)
|
return TemplateResponse(request, "ostatus/subscribe.html", data)
|
||||||
|
|
||||||
if type(wf_response) == WebFingerError:
|
if isinstance(wf_response, WebFingerError):
|
||||||
data = {
|
data = {
|
||||||
"account": remote_user,
|
"account": remote_user,
|
||||||
"user": user,
|
"user": user,
|
||||||
|
|
|
@ -18,7 +18,8 @@ from bookwyrm.utils import regex
|
||||||
class WebFingerError(Exception):
|
class WebFingerError(Exception):
|
||||||
"""error class for problems finding user information with webfinger"""
|
"""error class for problems finding user information with webfinger"""
|
||||||
|
|
||||||
pass
|
def __init__(self, message):
|
||||||
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
def get_user_from_username(viewer, username):
|
def get_user_from_username(viewer, username):
|
||||||
|
|
Loading…
Reference in a new issue