fix typos and needless try/except from PR review

This commit is contained in:
Matthew Hodgson 2016-04-11 10:39:16 +01:00
parent 83b2f83da0
commit 5ffacc5e84

View File

@ -54,7 +54,7 @@ class PreviewUrlResource(BaseMediaResource):
if html:
pass
except:
raise RunTimeError("Disabling PreviewUrlResource as lxml not available")
raise RuntimeError("Disabling PreviewUrlResource as lxml not available")
if not hasattr(hs.config, "url_preview_ip_range_blacklist"):
logger.warn(
@ -62,7 +62,7 @@ class PreviewUrlResource(BaseMediaResource):
"blacklist in url_preview_ip_range_blacklist for url previewing "
"to work"
)
raise RunTimeError(
raise RuntimeError(
"Disabling PreviewUrlResource as "
"url_preview_ip_range_blacklist not specified"
)
@ -91,7 +91,6 @@ class PreviewUrlResource(BaseMediaResource):
@defer.inlineCallbacks
def _async_render_GET(self, request):
try:
# XXX: if get_user_by_req fails, what should we do in an async render?
requester = yield self.auth.get_user_by_req(request)
url = request.args.get("url")[0]
@ -240,8 +239,6 @@ class PreviewUrlResource(BaseMediaResource):
)
respond_with_json_bytes(request, 200, json.dumps(og), send_cors=True)
except Exception as e:
raise e
@defer.inlineCallbacks