From ce15648251512e20bcc7e528c4070e05672f2e7d Mon Sep 17 00:00:00 2001 From: Joakim Carlstein Date: Mon, 22 Jan 2024 10:16:35 +0100 Subject: [PATCH] feat(types): add type for the onAbort Reporter method --- .changeset/late-phones-smile.md | 5 +++++ packages/types/src/index.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/late-phones-smile.md diff --git a/.changeset/late-phones-smile.md b/.changeset/late-phones-smile.md new file mode 100644 index 0000000..31a36d0 --- /dev/null +++ b/.changeset/late-phones-smile.md @@ -0,0 +1,5 @@ +--- +'@emigrate/types': minor +--- + +Add type for onAbort Reporter method diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index dea668d..89a546a 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -243,6 +243,14 @@ export type EmigrateReporter = Partial<{ * Called when the reporter is initialized, which is the first method that is called when a command is executed. */ onInit(parameters: ReporterInitParameters): Awaitable; + /** + * Called when the current command (in practice the "up" command) is aborted. + * + * This is called when the process is interrupted, e.g. by a SIGTERM or SIGINT signal, or an unhandled error occurs. + * + * @param reason The reason why the command was aborted. + */ + onAbort(reason: Error): Awaitable; /** * Called when all pending migrations that should be executed have been collected. *