Skip to content

Commit

Permalink
render informative error page when report is found on database but no…
Browse files Browse the repository at this point in the history
…t retrievable
  • Loading branch information
anderson-mj committed Dec 13, 2024
1 parent 961ab31 commit b6dc0c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def set_report
end

def check_downloadable
raise ActionController::RoutingError.new("Este documento expirou.") if cant_download?(@report)
render("reports/expired_or_invalid_report") if cant_download?(@report)
end

def cant_download?(record)
Expand Down
4 changes: 4 additions & 0 deletions app/views/reports/expired_or_invalid_report.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div style="max-width: 90%; width: 310px; margin: 10% auto 0 auto; padding: 30px; text-align: center; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fff; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
<h1 style="font-size: 24px; font-weight: bold; color: #dc3545; margin-bottom: 20px;">Erro</h1>
<p style="font-size: 16px; color: #555;">Documento invalidado ou expirado</p>
</div>

0 comments on commit b6dc0c0

Please sign in to comment.