diff --git a/.changeset/six-gifts-count.md b/.changeset/six-gifts-count.md new file mode 100644 index 000000000..6c199108a --- /dev/null +++ b/.changeset/six-gifts-count.md @@ -0,0 +1,5 @@ +--- +"@saleor/webhook-utils": patch +--- + +Migrations will now exit with error (1) if error occurs diff --git a/packages/webhook-utils/src/webhook-migration-runner.ts b/packages/webhook-utils/src/webhook-migration-runner.ts index a49a1532a..7463ed61b 100644 --- a/packages/webhook-utils/src/webhook-migration-runner.ts +++ b/packages/webhook-utils/src/webhook-migration-runner.ts @@ -1,13 +1,14 @@ import { WebhookManifest } from "@saleor/app-sdk/types"; import { Client } from "urql"; + import { AppPermissionDeniedError, NetworkError, UnknownConnectionError } from "./errors"; import { AppDetails, getAppDetailsAndWebhooksData, } from "./operations/get-app-details-and-webhooks-data"; import { - SaleorInstanceDetails, getSaleorInstanceDetails, + SaleorInstanceDetails, } from "./operations/get-saleor-instance-details"; import { Logger } from "./types"; import { WebhookUpdater } from "./webhook-updater"; @@ -75,12 +76,22 @@ export class WebhookMigrationRunner { }); break; case error instanceof UnknownConnectionError: - logger.error(`Migration finished with error while fetching data from Saleor`, { - error, - }); + logger.error( + `Migration finished with error while fetching data from Saleor. Aborting...`, + { + error, + }, + ); + + process.exit(1); + break; default: - logger.error(`Migration finished with error while running migrations`, { error }); + logger.error(`Migration finished with error while running migrations. Aborting...`, { + error, + }); + + process.exit(1); } } };