Skip to content

Commit

Permalink
fix(cli): initialize mailer just if connection can be verified (n8n-i…
Browse files Browse the repository at this point in the history
  • Loading branch information
BHesseldieck authored Sep 1, 2022
1 parent 61d3ef7 commit 5afd3ec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/cli/src/UserManagement/email/UserManagementMailer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Handlebars from 'handlebars';
import { existsSync } from 'fs';
import { readFile } from 'fs/promises';
import Handlebars from 'handlebars';
import { join as pathJoin } from 'path';
// eslint-disable-next-line import/no-cycle
import { GenericHelpers } from '../..';
Expand Down Expand Up @@ -90,7 +90,12 @@ let mailerInstance: UserManagementMailer | undefined;
export async function getInstance(): Promise<UserManagementMailer> {
if (mailerInstance === undefined) {
mailerInstance = new UserManagementMailer();
await mailerInstance.verifyConnection();
try {
await mailerInstance.verifyConnection();
} catch (error) {
mailerInstance = undefined;
throw error;
}
}
return mailerInstance;
}

0 comments on commit 5afd3ec

Please sign in to comment.