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