Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: aws-dc-21/QueryApp
base: ae7c7cc0cf
...
head fork: aws-dc-21/QueryApp
compare: 9a02bb91ae
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
1  Gemfile
@@ -15,6 +15,7 @@ end
group :development, :test do
gem 'rspec-rails'
+ gem 'byebug'
end
group :development, :test do
View
6 Gemfile.lock
@@ -31,8 +31,13 @@ GEM
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
builder (3.1.4)
+ byebug (2.3.1)
+ columnize (~> 0.3.6)
+ debugger-linecache (~> 1.2.0)
codemirror-rails (3.16)
railties (>= 3.0, < 5)
+ columnize (0.3.6)
+ debugger-linecache (1.2.0)
diff-lcs (1.2.5)
dotenv (0.9.0)
dotenv-rails (0.9.0)
@@ -133,6 +138,7 @@ PLATFORMS
DEPENDENCIES
bootstrap-sass (~> 2.3.2.0)
+ byebug
codemirror-rails
dotenv-rails
jbuilder (~> 1.2)
View
4 app/assets/javascripts/application.js
@@ -54,10 +54,12 @@ $(function() {
$this.attr('href', newHref);
});
- // TODO: error handling
$document.on('ajax:success', '#query-container form', function (event, data, status, xhr) {
$('#query-results-container').html(data);
});
+ $document.on('ajax:error', '#query-container form', function (event, data, status, xhr) {
+ $('#query-results-container').html(data.responseText);
+ });
$document.on('ajax:success', '#saved-queries a', function (event, data, status, xhr) {
$('#query-container .run_query_sql .help-block').html(data.description);
View
6 app/controllers/run_queries_controller.rb
@@ -22,8 +22,12 @@ def create
send_data @query_runner.to_csv, :filename => 'data.csv'
end
else
- render :action => 'new'
+ flash[:errors] = @run_query.errors.full_messages
+ render :partial => 'errors', :status => 422
end
+ rescue => e
+ flash[:errors] = [e.message]
+ render :partial => 'errors', :status => 500
end
private
View
5 app/views/run_queries/_errors.html.erb
@@ -0,0 +1,5 @@
+<ul>
+<% flash[:errors].each do |error| %>
+ <li class="text-error"><%= error %></li>
+<% end%>
+</ul>

No commit comments for this range

Something went wrong with that request. Please try again.