-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7de5226
commit e4f8453
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Kaui | ||
module ExceptionHelper | ||
def standardize_exception(exception) | ||
case exception | ||
when ActiveRecord::DatabaseConnectionError | ||
"Unable to connect to the database." | ||
when Errno::ECONNREFUSED | ||
url = exception.message.match(/for "(.*)" port/)[1] rescue nil | ||
(KillBillClient.url.include? url) ? "Unable to connect to the Kill Bill server." : nil | ||
when -> (e) { e.class.name.start_with?('KillBillClient::API') } | ||
"Error while communicating with the Kill Bill server." | ||
else | ||
nil | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>We're sorry, but something went wrong (500)</title> | ||
<style type="text/css"> | ||
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } | ||
div.dialog { | ||
width: 35em; /* Increase the width of the dialog */ | ||
padding: 1em 6em; /* Increase the padding of the dialog */ | ||
margin: 4em auto 0 auto; | ||
border: 1px solid #ccc; | ||
border-right-color: #999; | ||
border-bottom-color: #999; | ||
font-size: 1.2em; /* Increase the font size in the dialog */ | ||
} | ||
h1 { font-size: 100%; color: #f00; line-height: 1.0em; } /* Increase the font size of the title */ | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<!-- This file lives in public/500.html --> | ||
<div class="dialog"> | ||
<h1>We're sorry, but something went wrong.</h1> | ||
<% if @error.present? %> | ||
<p><%= @error %></p> | ||
<% end %> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters