mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-14 20:16:31 +00:00
Add media proxying error logging
This commit is contained in:
parent
84dcf49079
commit
b8fe212e94
1 changed files with 2 additions and 0 deletions
|
@ -37,6 +37,7 @@ proc proxyMedia*(req: jester.Request; url: string): Future[HttpCode] {.async.} =
|
|||
try:
|
||||
let res = await client.get(url)
|
||||
if res.status != "200 OK":
|
||||
echo "[media] Proxying media failed, status: $1, url: $2, body: $3" % [res.status, url, await res.body]
|
||||
return Http404
|
||||
|
||||
let hashed = $hash(url)
|
||||
|
@ -65,6 +66,7 @@ proc proxyMedia*(req: jester.Request; url: string): Future[HttpCode] {.async.} =
|
|||
await request.client.send(data)
|
||||
data.setLen 0
|
||||
except HttpRequestError, ProtocolError, OSError:
|
||||
echo "[media] Proxying media exception, error: $1, url: $2" % [getCurrentExceptionMsg(), url]
|
||||
result = Http404
|
||||
finally:
|
||||
client.close()
|
||||
|
|
Loading…
Reference in a new issue