Skip to content
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

[6.x] [ML] Fixing error reporting in message bar (#18781) #18788

Merged
merged 1 commit into from
May 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ module
.catch((err) => {
// TODO - display error in cards saying data could not be loaded.
console.log('DataVisualizer - error getting stats for metric cards from elasticsearch:', err);
if (err.status === 500) {
if (err.statusCode === 500) {
notify.error(`Error loading data for metrics in index ${indexPattern.title}. ${err.message}. ` +
'The request may have timed out. Try using a smaller sample size or narrowing the time range.',
{ lifetime: 30000 });
Expand Down Expand Up @@ -545,7 +545,7 @@ module
.catch((err) => {
// TODO - display error in cards saying data could not be loaded.
console.log('DataVisualizer - error getting non metric field stats from elasticsearch:', err);
if (err.status === 500) {
if (err.statusCode === 500) {
notify.error(`Error loading data for fields in index ${indexPattern.title}. ${err.message}. ` +
'The request may have timed out. Try using a smaller sample size or narrowing the time range.',
{ lifetime: 30000 });
Expand Down Expand Up @@ -595,7 +595,7 @@ module
.catch((err) => {
// TODO - display error in cards saying data could not be loaded.
console.log('DataVisualizer - error getting overall stats from elasticsearch:', err);
if (err.status === 500) {
if (err.statusCode === 500) {
notify.error(`Error loading data for fields in index ${indexPattern.title}. ${err.message}. ` +
'The request may have timed out. Try using a smaller sample size or narrowing the time range.',
{ lifetime: 30000 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,17 @@ module.controller('MlJobTimepickerModal', function (
doStart();
})
.catch((resp) => {
if (resp.status === 409) {
if (resp.statusCode === 409) {
doStart();
} else {
if (resp.status === 500) {
if (resp.statusCode === 500) {
if (doStartCalled === false) {
// doStart hasn't been called yet, this 500 has returned before 10s,
// so it's not due to a timeout
msgs.error(`Could not open ${$scope.jobId}`, resp);
}
} else {
// console.log(resp);
msgs.error(`Could not open ${$scope.jobId}`, resp);
}
$scope.saveLock = false;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/ml/public/ml_nodes_check/check_ml_nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function getMlNodeCount() {
})
.catch((error) => {
mlNodeCount = 0;
if (error.status === 403) {
if (error.statusCode === 403) {
userHasPermissionToViewMlNodeCount = false;
} else {
console.error(error);
Expand Down
6 changes: 1 addition & 5 deletions x-pack/plugins/ml/public/services/http_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ export function http(options) {

fetch(url, payload)
.then((resp) => {
if (resp.ok === true) {
resolve(resp.json());
} else {
reject(resp);
}
resp.json().then((resp.ok === true) ? resolve : reject);
})
.catch((resp) => {
reject(resp);
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/ml/public/services/job_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class JobService {
}

function deleteFailed(resp, txt) {
if (resp.status === 500) {
if (resp.statusCode === 500) {
status.errorMessage = txt;
}
reject({ success: false });
Expand Down Expand Up @@ -905,7 +905,7 @@ class JobService {
})
.catch((err) => {
console.log('jobService error stopping datafeed:', err);
if (err.status === 500) {
if (err.statusCode === 500) {
msgs.error('Could not stop datafeed for ' + jobId);
msgs.error('Request may have timed out and may still be running in the background.');
} else {
Expand Down