Handle decompression errors

This commit is contained in:
Zed
2021-12-28 05:02:28 +01:00
parent 4b356118a6
commit 6bcbe0ea9f
3 changed files with 12 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import routes/[
unsupported, embed, resolver, router_utils]
const instancesUrl = "https://github.com/zedeus/nitter/wiki/Instances"
const issuesUrl = "https://github.com/zedeus/nitter/issues"
let configPath = getEnv("NITTER_CONF_FILE", "./nitter.conf")
let (cfg, fullCfg) = getConfig(configPath)
@ -75,11 +76,15 @@ routes:
error Http404:
resp Http404, showError("Page not found", cfg)
error InternalError:
echo error.exc.msg
const link = a("open a GitHub issue", href = issuesUrl)
resp Http500, showError(&"An error occurred, please {link} with the URL you tried to visit.", cfg)
error RateLimitError:
echo error.exc.msg
resp Http429, showError("Instance has been rate limited.<br>Use " &
a("another instance", href = instancesUrl) &
" or try again later.", cfg)
const link = a("another instance", href = instancesUrl)
resp Http429, showError(&"Instance has been rate limited.<br>Use {link} or try again later.", cfg)
extend unsupported, ""
extend preferences, ""