Use stringifyerror

Signed-off-by: Damon Kaswell <damon.kaswell1@hp.com>
This commit is contained in:
Damon Kaswell
2022-11-22 07:28:41 -08:00
committed by Fredrik Adelöw
parent 35455be414
commit 87cabfed8c
2 changed files with 3 additions and 4 deletions
@@ -33,6 +33,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/backend-tasks": "workspace:^",
"@backstage/catalog-model": "workspace:^",
@@ -26,6 +26,7 @@ import type { AbortSignal } from 'node-abort-controller';
import { performance } from 'perf_hooks';
import { Duration, DurationObjectUnits } from 'luxon';
import { v4 } from 'uuid';
import { stringifyError } from '@backstage/errors';
export class IncrementalIngestionEngine implements IterationEngine {
restLength: Duration;
@@ -118,10 +119,7 @@ export class IncrementalIngestionEngine implements IterationEngine {
const backoffLength = currentBackoff.as('milliseconds');
this.options.logger.error(error);
const truncatedError =
typeof error === 'string'
? error.substring(0, 700)
: `${error}`;
const truncatedError = stringifyError(error).substring(0, 700);
this.options.logger.error(
`incremental-engine: Ingestion '${ingestionId}' threw an error during ingestion burst. Ingestion will backoff for ${currentBackoff.toHuman()} (${truncatedError})`,
);