Skip to content

Commit

Permalink
Merge pull request #1780 from rashidkpc/fix/backend-down-message
Browse files Browse the repository at this point in the history
Improve error condition communication from backend
  • Loading branch information
rashidkpc committed Nov 5, 2014
2 parents 3258bda + d972f65 commit 0bb9efc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ <h1>Oops!</h1>
</p>

<p>
<button class="btn btn-success" onclick="window.location.reload();">
<i class="refresh fa fa-refresh"></i> Reload
<button class="btn btn-success" onclick="window.history.back();">
Go back
</button>
or
<a
Expand Down
9 changes: 7 additions & 2 deletions src/kibana/components/setup/steps/check_for_es.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ define(function (require) {

return function checkForES() {
var complete = notify.lifecycle('es check');
return es.ping({
return es.info({
method: 'GET',
requestTimeout: 2000
})
.catch(function (err) {
throw new SetupError('Unable to connect to Elasticsearch at "<%= configFile.elasticsearch %>"', err);
if (err.body && err.body.message) {
throw new SetupError(err.body.message, err);
} else {
throw new SetupError('Unknown error while connecting to Elasticsearch', err);
}
})
.then(complete, complete.failure);
};
Expand Down
2 changes: 2 additions & 0 deletions src/kibana/plugins/discover/_segmented_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ define(function (require) {
// don't throw ClusterBlockException errors
if (err.status === 403 && err.message.match(/ClusterBlockException.+index closed/)) {
resolve(false);
} else if (err.body && err.body.message) {
reject(err.body.message);
} else {
reject(err);
}
Expand Down
15 changes: 0 additions & 15 deletions src/server/lib/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ class App < Sinatra::Base
data.to_json + "\n"
end
set :logger, logger
disable :raise_errors
disable :show_exceptions
disable :dump_errors
end

configure :production do
Expand All @@ -50,18 +47,6 @@ class App < Sinatra::Base
use ColorLogger, settings.logger unless Kibana.global_settings[:quiet]
end

error do
500
end

error 400 do
json :status => 500, :message => "Bad Request"
end

error 500 do
json :status => 500, :message => "Internal Server Error"
end

not_found do
json :status => 404, :message => "Not Found"
end
Expand Down
20 changes: 20 additions & 0 deletions src/server/routes/base.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "sinatra/base"
require "sinatra/json"
require "yaml"
require "timeout"

module Kibana
module Routes
Expand All @@ -18,7 +19,26 @@ class Base < Sinatra::Base
set :httponly, true
set :config, config
set :bundled_plugin_ids, config['bundledPluginIds'] || []

set :show_exceptions, false
set :raise_errors, false
set :dump_errors, false
end

error do
status 500
end

error Errno::ECONNREFUSED do
status 502
json :message => "Unable to connect to Elasticsearch"
end

error Timeout::Error do
status 504
json :message => "Timeout while waiting for Elasticsearch"
end

end
end
end

0 comments on commit 0bb9efc

Please sign in to comment.