forked from gsamokovarov/web-console
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show an error message when an error response does not have JSON #157
Merged
gsamokovarov
merged 4 commits into
rails:master
from
sh19910711:patch/0020/show-error-message
Aug 14, 2015
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7d1f547
Move WebConsole::Template::Context into WebConsole::View
sh19910711 25889be
Use I18n module for system messages instead of hard-coded value
sh19910711 cd0cc02
Show an error message when a response does not have a JSON text
sh19910711 0f47ed9
Add test for the error response without JSON output
sh19910711 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,15 @@ | ||
en: | ||
errors: | ||
unavailable_session: | | ||
Session %{id} is is no longer available in memory. | ||
|
||
If you happen to run on a multi-process server (like Unicorn or Puma) the process | ||
this request hit doesn't store %{id} in memory. Consider turning the number of | ||
processes/workers to one (1) or using a different server in development. | ||
|
||
unacceptable_request: | | ||
A supported version is expected in the Accept header. | ||
|
||
connection_refused: | | ||
Oops! Failed to connect to the Web Console middleware. | ||
Please make sure a rails development server is running. |
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 |
---|---|---|
|
@@ -66,5 +66,9 @@ class Railtie < ::Rails::Railtie | |
Middleware.whiny_requests = config.web_console.whiny_requests | ||
end | ||
end | ||
|
||
initializer 'i18n.load_path' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly that, yes! 👍 |
||
config.i18n.load_path.concat(Dir[File.expand_path('../locales/*.yml', __FILE__)]) | ||
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
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
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,33 @@ | ||
module WebConsole | ||
class View < ActionView::Base | ||
# Execute a block only on error pages. | ||
# | ||
# The error pages are special, because they are the only pages that | ||
# currently require multiple bindings. We get those from exceptions. | ||
def only_on_error_page(*args) | ||
yield if @env['web_console.exception'].present? | ||
end | ||
|
||
# Render JavaScript inside a script tag and a closure. | ||
# | ||
# This one lets write JavaScript that will automatically get wrapped in a | ||
# script tag and enclosed in a closure, so you don't have to worry for | ||
# leaking globals, unless you explicitly want to. | ||
def render_javascript(template) | ||
render(template: template, layout: 'layouts/javascript') | ||
end | ||
|
||
# Render inlined string to be used inside of JavaScript code. | ||
# | ||
# The inlined string is returned as an actual JavaScript string. You | ||
# don't need to wrap the result yourself. | ||
def render_inlined_string(template) | ||
render(template: template, layout: 'layouts/inlined_string') | ||
end | ||
|
||
# Escaped alias for "ActionView::Helpers::TranslationHelper.t". | ||
def t(key, options = {}) | ||
super.gsub("\n", "\\n") | ||
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is to use
xhr.statusText
.