feat(chore): improve dkim loading error message

This commit is contained in:
Julien Oculi 2024-04-02 12:24:21 +02:00
parent 82533c7de9
commit 62b85ce3c9

View file

@ -1,10 +1,11 @@
// @deno-types="npm:@types/nodemailer"
import nodemailer from 'nodemailer'
const dkimPrivateKey = await Deno.readTextFile(
'/home/julien/dkim_sendmail_keys/dkim_sendmail_cohabit_fr.pem',
).catch((cause) => {
throw new Error('unable to load DKIM private key', { cause })
const dkimPath = '/home/julien/dkim_sendmail_keys/dkim_sendmail_cohabit_fr.pem'
const dkimPrivateKey = await Deno.readTextFile(dkimPath).catch((cause) => {
throw new Error(`unable to load DKIM private key from "${dkimPath}"`, {
cause,
})
})
export const transporter = nodemailer.createTransport({