Skip to content

Commit

Permalink
Add more console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Nov 11, 2020
1 parent d3b502b commit d15b5f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ export class IndexPatternsService {

return !hasFieldCaps || !hasDocValuesFlag;
});
if (isFieldRefreshRequired) {
// eslint-disable-next-line no-console
console.log('isFieldRefreshRequired == true for specs', JSON.stringify(specs));
}
return isFieldRefreshRequired;
}

Expand Down Expand Up @@ -253,8 +249,6 @@ export class IndexPatternsService {
refreshFields = async (indexPattern: IndexPattern) => {
try {
const fields = await this.getFieldsForIndexPattern(indexPattern);
// eslint-disable-next-line no-console
console.log('refreshFields returns', JSON.stringify(fields));
const scripted = indexPattern.getScriptedFields().map((field) => field.spec);
indexPattern.fields.replaceAll([...fields, ...scripted]);
} catch (err) {
Expand Down Expand Up @@ -292,18 +286,20 @@ export class IndexPatternsService {
return this.fieldArrayToMap([...newFields, ...scriptdFields]);
} catch (err) {
// eslint-disable-next-line no-console
console.log('refreshFieldSpecMap ERROR', JSON.stringify(err));
console.log('refreshFieldSpecMap ERROR');
if (err instanceof IndexPatternMissingIndices) {
this.onNotification({ title: (err as any).message, color: 'danger', iconType: 'alert' });
return {};
}
const msg = i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
values: { id, title },
});

this.onError(err, {
title: i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
values: { id, title },
}),
title: msg,
});
throw new Error(msg);
}
return fields;
};
Expand Down Expand Up @@ -392,23 +388,17 @@ export class IndexPatternsService {
params: typeMeta && typeMeta.params,
})
: spec.fields;
if (isFieldRefreshRequired) {
// eslint-disable-next-line no-console
console.log('fields fetched', JSON.stringify(spec.fields));
}
} catch (err) {
isSaveRequired = false;
if (err instanceof IndexPatternMissingIndices) {
// eslint-disable-next-line no-console
console.error('index pattern missing', JSON.stringify(err));
this.onNotification({
title: (err as any).message,
color: 'danger',
iconType: 'alert',
});
} else {
// eslint-disable-next-line no-console
console.error('fields fetching not possible', JSON.stringify(err));
console.error('fields fetching not possible');
this.onError(err, {
title: i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
Expand All @@ -426,8 +416,6 @@ export class IndexPatternsService {
indexPatternCache.set(id, indexPattern);
if (isSaveRequired) {
try {
// eslint-disable-next-line no-console
console.error('updateSavedObject starts', JSON.stringify(spec.fields));
this.updateSavedObject(indexPattern);
} catch (err) {
this.onError(err, {
Expand All @@ -442,10 +430,6 @@ export class IndexPatternsService {
});
}
}
if (isFieldRefreshRequired) {
// eslint-disable-next-line no-console
console.error('resetOriginalSavedObjectBode', JSON.stringify(spec.fields));
}
indexPattern.resetOriginalSavedObjectBody();
return indexPattern;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export class IndexPatternsApiClient implements IIndexPatternsApiClient {
query,
})
.catch((resp: any) => {
// eslint-disable-next-line no-console
console.error('IndexPatternsApiClient ERROR');
// eslint-disable-next-line no-console
console.error('IndexPatternsApiClient ERROR DEBUG', JSON.stringify(resp));

if (resp.body.statusCode === 404 && resp.body.attributes?.code === 'no_matching_indices') {
throw new IndexPatternMissingIndices(resp.body.message);
}
Expand Down

0 comments on commit d15b5f1

Please sign in to comment.