Skip to content
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 @@ -78,12 +78,19 @@ export function registerAnnotationAPIs({
return response.ok({
body: res,
});
} catch (err) {
logger.error(err);
} catch (error) {
const statusCode = error.output?.statusCode ?? 500;
const errorMessage = error.output?.payload?.message ?? 'An internal server error occurred';
if (statusCode >= 500) {
logger.error(errorMessage, { error });
} else {
logger.debug(errorMessage, { error });
}

return response.custom({
statusCode: err.output?.statusCode ?? 500,
statusCode,
body: {
message: err.output?.payload?.message ?? 'An internal server error occurred',
message: errorMessage,
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class RelatedDashboardsClient {
const panels = d.attributes.panels;
const matchingPanels = this.getPanelsByIndex(index, panels);
if (matchingPanels.length > 0) {
this.logger.info(
this.logger.debug(
() => `Found ${matchingPanels.length} panel(s) in dashboard ${d.id} using index ${index}`
);
relevantDashboards.push({
Expand Down Expand Up @@ -151,7 +151,7 @@ export class RelatedDashboardsClient {
matchingPanels.map((p) => Array.from(p.matchingFields)).flat()
);
if (matchingPanels.length > 0) {
this.logger.info(
this.logger.debug(
() =>
`Found ${matchingPanels.length} panel(s) in dashboard ${
d.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export async function createOrUpdateIndex({
},
{
onFailedAttempt: (e) => {
logger.warn(`Could not create index: '${index}'. Retrying...`);
logger.warn(e);
logger.warn(`Could not create index: '${index}'. Retrying...`, { error: e });
},
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ export async function createOrUpdateIndexTemplate({
},
{
onFailedAttempt: (e) => {
logger.warn(`Could not create index template: '${indexTemplate.name}'. Retrying...`);
logger.warn(e);
logger.warn(`Could not create index template: '${indexTemplate.name}'. Retrying...`, {
error: e,
});
},
}
);
} catch (e) {
logger.error(`Could not create index template: '${indexTemplate.name}'. Error: ${e.message}.`);
logger.error(`Could not create index template: '${indexTemplate.name}'. Error: ${e.message}.`, {
error: e,
});
}
}