forked from midou/invidious
Merge pull request #1504 from saltycrys/improve-error-message
Improve error message
This commit is contained in:
commit
417fa3cf3c
@ -15,16 +15,16 @@ def error_template_helper(env : HTTP::Server::Context, config : Config, locale :
|
|||||||
return error_template_helper(env, config, locale, status_code, exception.message || "")
|
return error_template_helper(env, config, locale, status_code, exception.message || "")
|
||||||
end
|
end
|
||||||
env.response.status_code = status_code
|
env.response.status_code = status_code
|
||||||
|
issue_template = %(Date: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}`)
|
||||||
|
issue_template += %(\nRoute: `#{env.request.resource}`)
|
||||||
|
issue_template += %(\nVersion: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}`)
|
||||||
|
#issue_template += %(\nPreferences: ```#{env.get("preferences").as(Preferences).to_json}```)
|
||||||
|
issue_template += %(\nBacktrace: \n```\n#{exception.inspect_with_backtrace}```)
|
||||||
error_message = <<-END_HTML
|
error_message = <<-END_HTML
|
||||||
Looks like you've found a bug in Invidious. Feel free to open a new issue
|
Looks like you've found a bug in Invidious. Please open a new issue
|
||||||
<a href="https://github.com/iv-org/invidious/issues">here</a>
|
<a href="https://github.com/iv-org/invidious/issues">on GitHub</a>
|
||||||
or send an email to
|
and include the following text in your message:
|
||||||
<a href="mailto:#{CONFIG.admin_email}">#{CONFIG.admin_email}</a>.
|
<pre style="padding: 20px; background: rgba(0, 0, 0, 0.12345);">#{issue_template}</pre>
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
Please include the following text in your message:
|
|
||||||
<pre style="padding: 20px; background: rgba(0, 0, 0, 0.12345);">#{exception.inspect_with_backtrace}</pre>
|
|
||||||
END_HTML
|
END_HTML
|
||||||
return templated "error"
|
return templated "error"
|
||||||
end
|
end
|
||||||
|
@ -998,7 +998,7 @@ def fetch_video(id, region)
|
|||||||
}.try { |a| JSON::Any.new(a) } || JSON::Any.new([] of JSON::Any)
|
}.try { |a| JSON::Any.new(a) } || JSON::Any.new([] of JSON::Any)
|
||||||
end
|
end
|
||||||
|
|
||||||
raise info["reason"]?.try &.as_s || "" if !info["videoDetails"]?
|
raise InfoException.new(info["reason"]?.try &.as_s || "") if !info["videoDetails"]?
|
||||||
|
|
||||||
video = Video.new({
|
video = Video.new({
|
||||||
id: id,
|
id: id,
|
||||||
|
Loading…
Reference in New Issue
Block a user